From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752848AbbE1Ccx (ORCPT ); Wed, 27 May 2015 22:32:53 -0400 Received: from cantor2.suse.de ([195.135.220.15]:37935 "EHLO mx2.suse.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751185AbbE1Ccq (ORCPT ); Wed, 27 May 2015 22:32:46 -0400 Date: Thu, 28 May 2015 12:32:33 +1000 From: NeilBrown To: Keith Busch Cc: Jens Axboe , lkml Subject: LOCKDEP warning due to ext_devt_lock Message-ID: <20150528123233.3df8ff55@notabene.brown> X-Mailer: Claws Mail 3.10.1-162-g4d0ed6 (GTK+ 2.24.25; x86_64-suse-linux-gnu) MIME-Version: 1.0 Content-Type: multipart/signed; micalg=pgp-sha1; boundary="Sig_/kQtPulQfySF81EPB2JHE+fG"; protocol="application/pgp-signature" Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org --Sig_/kQtPulQfySF81EPB2JHE+fG Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: quoted-printable Hi Keith, I'm getting lockdep warning around use of ext_devt_lock. [11428.266019] inconsistent {SOFTIRQ-ON-W} -> {IN-SOFTIRQ-W} usage. As you say in 2da78092dda1 ("block: Fix dev_t minor allocation lifetime") ext_devt_lock can be taken from call_rcu's soft-irq. I think that means it should always use the _irq verion of spinlock. I've been using the following patch and the LOCKDEP message are gone. If you agree, could you forward it or something similar upstream? Thanks, NeilBrown Signed-off-by: NeilBrown diff --git a/block/genhd.c b/block/genhd.c index 666e11b83983..d1338934562e 100644 --- a/block/genhd.c +++ b/block/genhd.c @@ -422,9 +422,9 @@ int blk_alloc_devt(struct hd_struct *part, dev_t *devt) /* allocate ext devt */ idr_preload(GFP_KERNEL); =20 - spin_lock(&ext_devt_lock); + spin_lock_irq(&ext_devt_lock); idx =3D idr_alloc(&ext_devt_idr, part, 0, NR_EXT_DEVT, GFP_NOWAIT); - spin_unlock(&ext_devt_lock); + spin_unlock_irq(&ext_devt_lock); =20 idr_preload_end(); if (idx < 0) @@ -449,9 +449,9 @@ void blk_free_devt(dev_t devt) return; =20 if (MAJOR(devt) =3D=3D BLOCK_EXT_MAJOR) { - spin_lock(&ext_devt_lock); + spin_lock_irq(&ext_devt_lock); idr_remove(&ext_devt_idr, blk_mangle_minor(MINOR(devt))); - spin_unlock(&ext_devt_lock); + spin_unlock_irq(&ext_devt_lock); } } =20 @@ -690,13 +690,13 @@ struct gendisk *get_gendisk(dev_t devt, int *partno) } else { struct hd_struct *part; =20 - spin_lock(&ext_devt_lock); + spin_lock_irq(&ext_devt_lock); part =3D idr_find(&ext_devt_idr, blk_mangle_minor(MINOR(devt))); if (part && get_disk(part_to_disk(part))) { *partno =3D part->partno; disk =3D part_to_disk(part); } - spin_unlock(&ext_devt_lock); + spin_unlock_irq(&ext_devt_lock); } =20 return disk; --Sig_/kQtPulQfySF81EPB2JHE+fG Content-Type: application/pgp-signature Content-Description: OpenPGP digital signature -----BEGIN PGP SIGNATURE----- Version: GnuPG v2 iQIVAwUBVWZ+QTnsnt1WYoG5AQKLqA/+NRUOfaqRHiOhXaHPQvvqrk2GCmc83A0u Z8r/hC+xBxoOjSyhKa85/U3VQsUaicnEOfNTzyGULFL/PAicAZo5nGSRhJetWivr lJR8VeKIOlAmPcxZvpxlFft7oQDBNWY8dB5pplor91scJdCgwituzh8FCZvXzggr xiXOEGRMnthbDxNq9BLUk8bNXxlsoF5F5ng3E37cysJ51hDCBO58KRGDAPuICUNx V2B7UEHxzLIjSOsm9cPbmB1xFMCMCF+Jry9EYU5MfQXOtX72OESQqTATHAX2Ibd9 A409c7Un/GxZwlcALoXxlCWERGYX34QZjle5r8jJgQm3jrsCs2tQODihTpoFp3KA hU5XIeEJ/DS0as2Etey9k8fB8GyB/86WcF62vWzVCuJ6AquZHPmMXYtjTg58J98U yRbTynJG768StK7QMCOK5kQwZx1rbj/dOqQXuhxpLOzNmkwmSG9oAGTDqLaUAa9z 5axLgj3SrVFxUjqPN1aUqLY6Rrbwn7vWto7yXcs80PG68VuY8+A4QM5ULxvsOKVu k+BqVAbliUSnJWTb8vooeFlPO5bF0QA8bLUvTno5VWpQHTFi0ZONIFMU9Kw3jo8w sIGvu1aLjzOdk8rV1CB5zqcBE4PnkQErrdC7k636MIcbcYYuimpt6MHJn7kHfDme /m5oxMP7QrY= =84CC -----END PGP SIGNATURE----- --Sig_/kQtPulQfySF81EPB2JHE+fG--