NetBSD-Bugs archive

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

Re: port-i386/37193 (x86 pmap concurrency strategy could use improvement)



The following reply was made to PR port-i386/37193; it has been noted by GNATS.

From: yamt%mwd.biglobe.ne.jp@localhost (YAMAMOTO Takashi)
To: gnats-bugs%NetBSD.org@localhost
Cc: yamt%NetBSD.org@localhost, gnats-admin%netbsd.org@localhost, 
netbsd-bugs%netbsd.org@localhost,
        ad%netbsd.org@localhost
Subject: Re: port-i386/37193 (x86 pmap concurrency strategy could use
 improvement)
Date: Mon, 14 Jan 2008 02:58:32 +0900 (JST)

 >  > +retry:
 >  > + mutex_spin_enter(&pvh->pvh_lock);
 >  > + while ((pve = SPLAY_MIN(pvtree, &pvh->pvh_root)) != NULL) {
 >  > +         struct pmap *pmap = pve->pv_pmap;
 >  > +         pt_entry_t *ptep;
 >  > +         pt_entry_t opte;
 >  >  
 >  >           /* atomically save the old PTE and zap! it */
 >  > -         opte = pmap_pte_testset(&ptes[pl1_i(pve->pv_va)], 0);
 >  > -         KASSERT(pmap_valid_entry(opte));
 >  > -         KDASSERT(pmap_pte2pa(opte) == VM_PAGE_TO_PHYS(pg));
 >  > -
 >  > -         if (opte & PG_W)
 >  > -                 pve->pv_pmap->pm_stats.wired_count--;
 >  > -         pve->pv_pmap->pm_stats.resident_count--;
 >  > +         ptep = pmap_map_pte(pve->pv_ptp, pve->pv_va);
 >  > +         do {
 >  > +                 opte = *ptep;
 >  > +                 if ((opte & (PG_FRAME | PG_V)) != expect) {
 >  > +                         pmap_unmap_pte();
 >  > +                         mutex_spin_exit(&pvh->pvh_lock);
 >  > +                         x86_pause();
 >  > +                         goto retry;
 >  
 >  This loop makes me suspicious. I need to look more closely but is there
 >  any chance of a deadlock if the caller holds kernel_lock and a device
 >  interrupt occurs on a CPU that we need to make progress?
 >  
 >  Thanks,
 >  Andrew
 
 you're right.  i made it drop kernel_lock around x86_pause().
 
 YAMAMOTO Takashi
 



Home | Main Index | Thread Index | Old Index