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:11:42 -0400 Message-ID: <4A5B4EAE.7040707@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> <4A5B4CDC.1000806@gmail.com> Mime-Version: 1.0 Content-Type: multipart/signed; micalg=pgp-sha1; protocol="application/pgp-signature"; boundary="------------enigB20BF995D0E6A40B59F25695" Cc: kvm@vger.kernel.org, avi@redhat.com, mtosatti@redhat.com To: Gleb Natapov Return-path: Received: from mail-gx0-f215.google.com ([209.85.217.215]:59745 "EHLO mail-gx0-f215.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1756085AbZGMPLt (ORCPT ); Mon, 13 Jul 2009 11:11:49 -0400 Received: by gxk11 with SMTP id 11so2596414gxk.13 for ; Mon, 13 Jul 2009 08:11:48 -0700 (PDT) In-Reply-To: <4A5B4CDC.1000806@gmail.com> Sender: kvm-owner@vger.kernel.org List-ID: This is an OpenPGP/MIME signed message (RFC 2440 and 3156) --------------enigB20BF995D0E6A40B59F25695 Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: quoted-printable Gregory Haskins wrote: > Gleb Natapov wrote: > =20 >> On Mon, Jul 13, 2009 at 10:29:02AM -0400, Gregory Haskins wrote: >> =20 >> =20 >>> Gleb Natapov wrote: >>> =20 >>> =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 >>>> =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 a= s >>> well fail the system, IMO. >>> >>> =20 >>> =20 >> Well I don't really care but we have WARN_ON() in the code currently. >> =20 >> =20 > > Well, that is perhaps unfortunate, but not relevant. I am not reviewin= g > those patches ;) > > =20 >> Besides the chances are good that even without locking around this >> function nothing will break, so why kill host kernel? >> =20 >> =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. > =20 Err..precedent, I mean. Heh. /me needs more coffee. -Greg > Kind Regards, > -Greg > > > =20 --------------enigB20BF995D0E6A40B59F25695 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 iEYEARECAAYFAkpbTq4ACgkQP5K2CMvXmqGyLQCgidZj6kAumjKeCfHEZ4qtpNRD q2AAnja+Fe7oCaO4+3hqZ+7DMniQo9VL =SGPk -----END PGP SIGNATURE----- --------------enigB20BF995D0E6A40B59F25695--