From mboxrd@z Thu Jan 1 00:00:00 1970 From: Gregory Haskins Subject: Re: [PATCH 1/5] Protect irq_sources_bitmap by kvm->lock instead of kvm->irq_lock Date: Mon, 13 Jul 2009 11:03:56 -0400 Message-ID: <4A5B4CDC.1000806@gmail.com> References: <1247476355-27284-1-git-send-email-gleb@redhat.com> <1247476355-27284-2-git-send-email-gleb@redhat.com> <4A5B44AE.4000407@gmail.com> <20090713143941.GT28046@redhat.com> Mime-Version: 1.0 Content-Type: multipart/signed; micalg=pgp-sha1; protocol="application/pgp-signature"; boundary="------------enig86D99F190240FC5AA9F54AFC" Cc: kvm@vger.kernel.org, avi@redhat.com, mtosatti@redhat.com To: Gleb Natapov Return-path: Received: from an-out-0708.google.com ([209.85.132.243]:38222 "EHLO an-out-0708.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1755975AbZGMPED (ORCPT ); Mon, 13 Jul 2009 11:04:03 -0400 Received: by an-out-0708.google.com with SMTP id d40so4658879and.1 for ; Mon, 13 Jul 2009 08:04:02 -0700 (PDT) In-Reply-To: <20090713143941.GT28046@redhat.com> Sender: kvm-owner@vger.kernel.org List-ID: This is an OpenPGP/MIME signed message (RFC 2440 and 3156) --------------enig86D99F190240FC5AA9F54AFC Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: quoted-printable Gleb Natapov wrote: > On Mon, Jul 13, 2009 at 10:29:02AM -0400, Gregory Haskins wrote: > =20 >> Gleb Natapov wrote: >> =20 >>> diff --git a/virt/kvm/irq_comm.c b/virt/kvm/irq_comm.c >>> index 6c57e46..ce8fcd3 100644 >>> --- a/virt/kvm/irq_comm.c >>> +++ b/virt/kvm/irq_comm.c >>> @@ -210,7 +210,8 @@ int kvm_request_irq_source_id(struct kvm *kvm) >>> unsigned long *bitmap =3D &kvm->arch.irq_sources_bitmap; >>> int irq_source_id; >>> =20 >>> - mutex_lock(&kvm->irq_lock); >>> + WARN_ON(!mutex_is_locked(&kvm->lock)); >>> =20 >>> =20 >> Shouldn't this be fatal? (e.g. BUG_ON). I know the usage between >> BUG/WARN is controversial, but it seems to me that something is >> completely broken if you expect it to be locked and its not. Might as= >> well fail the system, IMO. >> >> =20 > Well I don't really care but we have WARN_ON() in the code currently. > =20 Well, that is perhaps unfortunate, but not relevant. I am not reviewing those patches ;) > Besides the chances are good that even without locking around this > function nothing will break, so why kill host kernel? > =20 The question to ask is: Is it legal to continue to run if the mutex is found unlocked? If not, the offending caller should be found/fixed as early as possible IMO, and an oops should be sufficient to do so. I think WARN_ON tends to gets overused/abused, so lets not perpetuate it simply because of precedence. Kind Regards, -Greg --------------enig86D99F190240FC5AA9F54AFC Content-Type: application/pgp-signature; name="signature.asc" Content-Description: OpenPGP digital signature Content-Disposition: attachment; filename="signature.asc" -----BEGIN PGP SIGNATURE----- Version: GnuPG/MacGPG2 v2.0.11 (Darwin) Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org iEYEARECAAYFAkpbTNwACgkQP5K2CMvXmqEnRgCeIg3LxeMakXbxyT1XOYUDz13Y l7QAmwf4n8V7JMnLWEPNmeOM5iq9jdVw =eXxy -----END PGP SIGNATURE----- --------------enig86D99F190240FC5AA9F54AFC--