From patchwork Wed Sep 18 23:14:22 2013 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Mikulas Patocka X-Patchwork-Id: 2909721 X-Patchwork-Delegate: snitzer@redhat.com Return-Path: X-Original-To: patchwork-dm-devel@patchwork.kernel.org Delivered-To: patchwork-parsemail@patchwork2.web.kernel.org Received: from mail.kernel.org (mail.kernel.org [198.145.19.201]) by patchwork2.web.kernel.org (Postfix) with ESMTP id E55F2BFF05 for ; Wed, 18 Sep 2013 23:19:56 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id E9F0320411 for ; Wed, 18 Sep 2013 23:19:55 +0000 (UTC) Received: from mx4-phx2.redhat.com (mx4-phx2.redhat.com [209.132.183.25]) by mail.kernel.org (Postfix) with ESMTP id F253E203E1 for ; Wed, 18 Sep 2013 23:19:54 +0000 (UTC) Received: from lists01.pubmisc.prod.ext.phx2.redhat.com (lists01.pubmisc.prod.ext.phx2.redhat.com [10.5.19.33]) by mx4-phx2.redhat.com (8.13.8/8.13.8) with ESMTP id r8INEP3n017610; Wed, 18 Sep 2013 19:14:27 -0400 Received: from int-mx12.intmail.prod.int.phx2.redhat.com (int-mx12.intmail.prod.int.phx2.redhat.com [10.5.11.25]) by lists01.pubmisc.prod.ext.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id r8INENPK018714 for ; Wed, 18 Sep 2013 19:14:23 -0400 Received: from file01.intranet.prod.int.rdu2.redhat.com (file01.intranet.prod.int.rdu2.redhat.com [10.11.5.7]) by int-mx12.intmail.prod.int.phx2.redhat.com (8.14.4/8.14.4) with ESMTP id r8INEMCH027596 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=NO); Wed, 18 Sep 2013 19:14:23 -0400 Received: from file01.intranet.prod.int.rdu2.redhat.com (localhost [127.0.0.1]) by file01.intranet.prod.int.rdu2.redhat.com (8.14.4/8.14.4) with ESMTP id r8INEMDX004105; Wed, 18 Sep 2013 19:14:22 -0400 Received: from localhost (mpatocka@localhost) by file01.intranet.prod.int.rdu2.redhat.com (8.14.4/8.14.4/Submit) with ESMTP id r8INEMDj004101; Wed, 18 Sep 2013 19:14:22 -0400 X-Authentication-Warning: file01.intranet.prod.int.rdu2.redhat.com: mpatocka owned process doing -bs Date: Wed, 18 Sep 2013 19:14:22 -0400 (EDT) From: Mikulas Patocka X-X-Sender: mpatocka@file01.intranet.prod.int.rdu2.redhat.com To: dm-devel@redhat.com, Zdenek Kabelac In-Reply-To: <5239F9FF.2010407@redhat.com> Message-ID: References: <52394ED9.5010308@redhat.com> <5239F9FF.2010407@redhat.com> User-Agent: Alpine 2.02 (LRH 1266 2009-07-14) MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.68 on 10.5.11.25 X-loop: dm-devel@redhat.com Cc: Tejun Heo , Stephen Boyd , "Alasdair G. Kergon" Subject: [dm-devel] [PATCH] dm-snapshot: workaround for a lockdep warning X-BeenThere: dm-devel@redhat.com X-Mailman-Version: 2.1.12 Precedence: junk Reply-To: device-mapper development List-Id: device-mapper development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: dm-devel-bounces@redhat.com Errors-To: dm-devel-bounces@redhat.com X-Spam-Status: No, score=-7.6 required=5.0 tests=BAYES_00, RCVD_IN_DNSWL_HI, RP_MATCHES_RCVD, UNPARSEABLE_RELAY autolearn=unavailable version=3.3.1 X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on mail.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP On Wed, 18 Sep 2013, Zdenek Kabelac wrote: > Dne 18.9.2013 17:57, Mikulas Patocka napsal(a): > > > > > > On Wed, 18 Sep 2013, Zdenek Kabelac wrote: > > > > > Dne 18.9.2013 02:08, Mikulas Patocka napsal(a): > > > > > > > > It's more complicated than that - the original Zdenek's report > > > > shows that the false warning happened on kernel > > > > "3.11.1-300.fc20.x86_64+debug". But I am not able to reproduce the > > > > bug on 3.11, I only reproduced it on 3.5-3.10 kernels. > > > > > > > > Zdenek, could you reproduce the bug on kernel 3.11? > > > > > > > > Mikulas > > > > > > > > > > > > > Since I do not have clean 3.11 at my hands - I've reproduced it with my > > > -rc6 > > > kernel (few patches based on 8495e9c4a9616c9d19f23182d0536485902259db) > > > With enabled kmemleak=on lockdep.prove_locking=1 lockdep.lock_stat=1. > > > > So - try this patch and tell me if it fixes the problem: > > > > Index: linux-2.6-devel/drivers/md/dm-snap-persistent.c > > =================================================================== > > --- linux-2.6-devel.orig/drivers/md/dm-snap-persistent.c 2013-05-10 > > 18:27:31.132358000 +0200 > > +++ linux-2.6-devel/drivers/md/dm-snap-persistent.c 2013-09-17 > > 18:41:39.023940000 +0200 > > @@ -256,7 +256,7 @@ > > */ > > INIT_WORK_ONSTACK(&req.work, do_metadata); > > queue_work(ps->metadata_wq, &req.work); > > - flush_work(&req.work); > > + flush_workqueue(ps->metadata_wq); > > > > return req.result; > > } > > > > Yes - this seems to eliminate reported INFO. OK - so I am submitting the patch for the upstream kernel too. > Though I'm getting curious why some tests are running much much much slower > when kmemleak and lockdep is in use. Because these checks slow things down - that's nothing unexpected. > Zdenek Mikulas --- dm-snapshot: workaround for a lockdep warning The kernel reports a lockdep warning if a snapshot is invalidated because it runs out of space. The lockdep warning was triggered by commit 0976dfc1d0cd80a4e9dfaf87bd8744612bde475a in the kernel 3.5. The warning is false positive. The real cause for the warning is that the lockdep engine treats different instances of md->lock as a single lock. This patch is a workaround - we use flush_workqueue instead of flush_work. This code path is not performance sensitive (it is called only on initialization or invalidation), thus it doesn't matter that we flush the whole workqueue. The real fix for the problem would be to teach the lockdep engine to treat different instances of md->lock as separate locks. Signed-off-by: Mikulas Patocka Acked-by: Alasdair G Kergon Cc: stable@kernel.org # 3.5+ -- dm-devel mailing list dm-devel@redhat.com https://www.redhat.com/mailman/listinfo/dm-devel Index: linux-2.6-devel/drivers/md/dm-snap-persistent.c =================================================================== --- linux-2.6-devel.orig/drivers/md/dm-snap-persistent.c 2013-05-10 18:27:31.132358000 +0200 +++ linux-2.6-devel/drivers/md/dm-snap-persistent.c 2013-09-17 18:41:39.023940000 +0200 @@ -256,7 +256,7 @@ */ INIT_WORK_ONSTACK(&req.work, do_metadata); queue_work(ps->metadata_wq, &req.work); - flush_work(&req.work); + flush_workqueue(ps->metadata_wq); return req.result; }