Re: [PATCH] VFS: br_write_lock locks on possible CPUs other than online CPUs

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

 



On Mon, 2011-12-19 at 16:00 +1100, Dave Chinner wrote:
> On Mon, Dec 19, 2011 at 04:11:42AM +0000, Al Viro wrote:
> > On Mon, Dec 19, 2011 at 11:36:15AM +0800, mengcong wrote:
> > > In a heavily loaded system, when frequently turning on and off CPUs, the
> > > kernel will detect soft-lockups on multiple CPUs. The detailed bug report
> > > is at https://lkml.org/lkml/2011/8/24/185.
> > > 
> > > The root cause is that brlock functions, i.e. br_write_lock() and
> > > br_write_unlock(), only locks/unlocks the per-CPU spinlock of CPUs that
> > > are online, which means, if one online CPU is locked and then goes
> > > offline, any later unlocking operation happens during its offline state
> > > will not touch it; and when it goes online again, it has the incorrect
> > > brlock state. This has been verified in current kernel.
> > > 
> > > I can reproduce this bug on the intact 3.1 kernel. After my patch applied, 
> > > I've ran an 8-hours long test(test script provided by the bug reporter), 
> > > and no soft lockup happened again.
> > 
> > Argh...  OK, that's seriously nasty.  I agree that this is broken, but
> > your patch makes br_write_lock() very costly on kernels build with
> > huge number of possible CPUs, even when it's run on a box with few
> > CPUs ;-/
> 
> I fixed this problem with the XFS per-cpu superblock counters
> (bit lock + counters in per-cpu structs) back in 2006. It basically
> uses a lglock-like local/global locking structure and iterates them
> using for_each_online_cpu().
> 
> I fixed it simply by registering a hotplug notifier and
> draining/reinitialising counters on the appropriate event under a
> global lock context. i.e. make CPU hotplug serialise against
> concurrent lock operations. See commit e8234a68 ("[XFS] Add support
> for hotplug CPUs...")
> 

how about to register a cpu hotplug notifier to align the brlock as what
Dave did?

> Cheers,
> 
> Dave.


--
To unsubscribe from this list: send the line "unsubscribe linux-fsdevel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[Index of Archives]     [Linux Ext4 Filesystem]     [Union Filesystem]     [Filesystem Testing]     [Ceph Users]     [Ecryptfs]     [AutoFS]     [Kernel Newbies]     [Share Photos]     [Security]     [Netfilter]     [Bugtraq]     [Yosemite News]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux Cachefs]     [Reiser Filesystem]     [Linux RAID]     [Samba]     [Device Mapper]     [CEPH Development]
  Powered by Linux