From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mail-lb0-f178.google.com (mail-lb0-f178.google.com [209.85.217.178]) (using TLSv1 with cipher RC4-SHA (128/128 bits)) (Client CN "smtp.gmail.com", Issuer "Google Internet Authority" (verified OK)) by huchra.bufferbloat.net (Postfix) with ESMTPS id A1B2C21F115 for ; Mon, 14 Jan 2013 00:18:58 -0800 (PST) Received: by mail-lb0-f178.google.com with SMTP id l5so2746557lbo.9 for ; Mon, 14 Jan 2013 00:18:56 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20120113; h=mime-version:in-reply-to:references:date:message-id:subject:from:to :cc:content-type; bh=iAhWS5Zb1UZi6aw38xrplJmhkcZja4Kzw48Znk8snbA=; b=IZZZsu/e37P7LGsb1QAga2JTHQ3TiGVir56joZQHha1qDW0rA1GZwaHOSuBWpoRLMc BcHvOG0RcK4u2ycDeKcSknkPTephwRLFLi4RMILR9toBsVLJlk6u3LzpWpydiaOgxO7V PFvqeCatZuLhOxAl3nbW/kGO/Ah52124mnJNWUTF9cvKJkVULcEWA3GIlgRi/F6eOFr9 6XHyCb8AAjbo2BA3FIE3IjxuDAY9bF/aYGEh9P5M6tcwL2TcLZ6XGFiYX+AbJYi89mH5 xOd8K5WVHhg1wrqgGPeJbxK2Vt41Q7xN38vv6cRBC0HZvKipkE/HWZfeFMZceuJH8jwJ lATQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20120113; h=mime-version:in-reply-to:references:date:message-id:subject:from:to :cc:content-type:x-gm-message-state; bh=iAhWS5Zb1UZi6aw38xrplJmhkcZja4Kzw48Znk8snbA=; b=FHOcF4pnHxwQpxlIswI0cC9pV9y4ycnTzDoGmQ6V0+w4izemX0Kb09edx9q/mk7JZH LI74CwjWPhn/vUsAosAMpRdF7BiaCbwGfML9t4PP8Nk9A0f5mKMoneWgnCasbj4Iz0So cYdBcfJNR2klI6G67yoiH7XiZSLnif4b6YE4PG8OUtvf9oiF48f9nlv9UaS+N2jqBIRQ DqNNLovoRiw60jUX5L1GOJyoWviPqqL09DmnQVuOzMt2VMr/HWlF37FBzD21z66eKAVE hBVr4uZ1qns8uWCHuUZqx0/MBZ9a3AvjbAAd/cOpilS8hqsTXE0EeUIQFi0Q37yZ1XcS fxDA== MIME-Version: 1.0 Received: by 10.112.16.205 with SMTP id i13mr33339455lbd.45.1358151536042; Mon, 14 Jan 2013 00:18:56 -0800 (PST) Received: by 10.112.6.166 with HTTP; Mon, 14 Jan 2013 00:18:55 -0800 (PST) In-Reply-To: References: <50F32981.9080404@openwrt.org> Date: Mon, 14 Jan 2013 00:18:55 -0800 Message-ID: From: Jerry Chu To: Eric Dumazet Content-Type: multipart/alternative; boundary=f46d0401fa4bdb654d04d33b4b36 X-Gm-Message-State: ALoCoQmHLR+sajLy/m2/6+0eycknxBcsBWc67oxqNOftV8vprXoxSa0TzWvu2U/xyX46gdDvUHpPd4xO6bKXOssMjtVhTY95aTqisRv+2Kz/vbwObfonHPLq097LfRf/0RYFCaPDqpRoHqiegn/QyVJ1jA0STpUbpCL2kwNScAG7XcJpAG9udOTvVNWUH5ZgfkZZmI+tmv8sp/5/nAfqQs/i32ad0BdaZA== Cc: cerowrt-devel , Yuchung Cheng Subject: Re: [Cerowrt-devel] TFO crashes cerowrt 3.7.1-1 X-BeenThere: cerowrt-devel@lists.bufferbloat.net X-Mailman-Version: 2.1.13 Precedence: list List-Id: Development issues regarding the cerowrt test router project List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 14 Jan 2013 08:18:59 -0000 --f46d0401fa4bdb654d04d33b4b36 Content-Type: text/plain; charset=ISO-8859-1 On Sun, Jan 13, 2013 at 7:05 PM, Eric Dumazet wrote: > Oh well yes, this doesnt quite work on !SMP. > Strange - how would one assert a spin lock is held, and obviously only for SMP? (I almost think arch_spin_is_locked(lock) should be ((void)(lock), 1) for UP for the purpose of assertion...) Also it looks like there are bunch of other places spin_is_locked() assertion is made in the source tree. (Perhaps they are only configured for MP?) Thanks, Jerry > And this kind of bug is frequent.... > > See following example : > > commit b9980cdcf2524c5fe15d8cbae9c97b3ed6385563 > Author: Hugh Dickins > Date: Wed Feb 8 17:13:40 2012 -0800 > > mm: fix UP THP spin_is_locked BUGs > > Fix CONFIG_TRANSPARENT_HUGEPAGE=y CONFIG_SMP=n CONFIG_DEBUG_VM=y > CONFIG_DEBUG_SPINLOCK=n kernel: spin_is_locked() is then always false, > and so triggers some BUGs in Transparent HugePage codepaths. > > asm-generic/bug.h mentions this problem, and provides a WARN_ON_SMP(x); > but being too lazy to add VM_BUG_ON_SMP, BUG_ON_SMP, WARN_ON_SMP_ONCE, > VM_WARN_ON_SMP_ONCE, just test NR_CPUS != 1 in the existing VM_BUG_ONs. > > Signed-off-by: Hugh Dickins > Cc: Andrea Arcangeli > Cc: > Signed-off-by: Andrew Morton > Signed-off-by: Linus Torvalds > > diff --git a/mm/huge_memory.c b/mm/huge_memory.c > index b3ffc21..91d3efb 100644 > --- a/mm/huge_memory.c > +++ b/mm/huge_memory.c > @@ -2083,7 +2083,7 @@ static void collect_mm_slot(struct mm_slot *mm_slot) > { > struct mm_struct *mm = mm_slot->mm; > > - VM_BUG_ON(!spin_is_locked(&khugepaged_mm_lock)); > + VM_BUG_ON(NR_CPUS != 1 && !spin_is_locked(&khugepaged_mm_lock)); > > > > > On Sun, Jan 13, 2013 at 1:39 PM, Felix Fietkau wrote: > >> On 2013-01-13 7:03 PM, Eric Dumazet wrote: >> > I suspect a bug in the spin_is_locked() implementation on your arch, as >> > he socket lock should be held at this point. >> I don't think this is an arch implementation bug, this probably happens >> on all !SMP systems. See this bit from include/linux/spinlock_up.h: >> >> #define arch_spin_is_locked(lock) ((void)(lock), 0) >> >> - Felix >> >> > --f46d0401fa4bdb654d04d33b4b36 Content-Type: text/html; charset=ISO-8859-1 Content-Transfer-Encoding: quoted-printable


On Sun, Jan 13, 2013 at 7:05 PM, Eric Dumazet <edumazet@google.com> wrote:
Oh well yes, this doesnt quite work = on !SMP.

Strange - how would one assert= a spin lock is held, and obviously only for SMP? (I almost think=A0arch_spin_is_locked(lo= ck) should be ((void)(lock), 1) for UP for the purpose of assertion...)

Also it looks like there are bunch of other= places spin_is_locked() assertion is made in the source tree. (Perhaps the= y are only configured for MP?)

Thanks,=

Jerry


And this kind of bug is frequent....

See following example :

commit= b9980cdcf2524c5fe15d8cbae9c97b3ed6385563
Date: =A0 Wed Feb 8 17:13:40 20= 12 -0800

=A0 =A0 mm: fix UP THP spin_is_locked BUGs
=A0 =A0=A0
<= div>=A0 =A0 Fix CONFIG_TRANSPARENT_HUGEPAGE=3Dy CONFIG_SMP=3Dn CONFIG_DEBUG= _VM=3Dy
=A0 =A0 CONFIG_DEBUG_SPINLOCK=3Dn kernel: spin_is_locked() is then always f= alse,
=A0 =A0 and so triggers some BUGs in Transparent HugePage c= odepaths.
=A0 =A0=A0
=A0 =A0 asm-generic/bug.h mentions this problem, and provides a WARN_ON_SMP= (x);
=A0 =A0 but being too lazy to add VM_BUG_ON_SMP, BUG_ON_SMP,= WARN_ON_SMP_ONCE,
=A0 =A0 VM_WARN_ON_SMP_ONCE, just test NR_CPUS= !=3D 1 in the existing VM_BUG_ONs.
=A0 =A0=A0
=A0 =A0 Signed-off-by: Hugh Dickins <hughd@google.com>
=A0 =A0 Cc: Andrea Arcangeli <aarcange@redhat.com>
=A0 =A0 Signed-off-by: Andre= w Morton <akpm@linux-foundation.org>
=A0 =A0 Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>= ;

diff --git a/mm/huge_memory.c b/mm/huge_memory.c=
index b3ffc21..91d3efb 100644
--- a/mm/huge_memory.c
+++ b/mm/huge_memory.c
@@ -2083,7 +2083,7 @@ static void colle= ct_mm_slot(struct mm_slot *mm_slot)
=A0{
=A0 =A0 =A0 =A0 struct mm_struct *mm =3D mm_slot->mm= ;
=A0
- =A0 =A0 =A0 VM_BUG_ON(!spin_is_locked(&khug= epaged_mm_lock));
+ =A0 =A0 =A0 VM_BUG_ON(NR_CPUS !=3D 1 && !spin_is_locked(&= ;khugepaged_mm_lock));




On Sun, Jan 13, 2013 at 1:39 PM, Felix Fietkau <nbd@openwrt.org> wrote:
On 2013-01-13 7:03 PM, Eric Dumazet wrote:
> I suspect a bug in the spin_is_locked() implementation on your arch, a= s
> he socket lock should be held at this point.
I don't think this is an arch implementation bug, this probably h= appens
on all !SMP systems. See this bit from include/linux/spinlock_up.h:

#define arch_spin_is_locked(lock) =A0 ((void)(lock), 0)

- Felix



--f46d0401fa4bdb654d04d33b4b36--