From mboxrd@z Thu Jan 1 00:00:00 1970 From: Dario Faggioli Subject: Re: [PATCH v2 1/2] IOMMU/spinlock: Fix a bug found in AMD IOMMU initialization. Date: Wed, 9 Mar 2016 15:45:00 +0100 Message-ID: <1457534700.3102.387.camel@citrix.com> References: <1457492889-36625-1-git-send-email-quan.xu@intel.com> <1457492889-36625-2-git-send-email-quan.xu@intel.com> <945CA011AD5F084CBEA3E851C0AB28894B85CA85@SHSMSX101.ccr.corp.intel.com> <1457519096.3102.327.camel@citrix.com> <945CA011AD5F084CBEA3E851C0AB28894B85E23E@SHSMSX101.ccr.corp.intel.com> <1457529599.3102.354.camel@citrix.com> <945CA011AD5F084CBEA3E851C0AB28894B85F359@SHSMSX101.ccr.corp.intel.com> <56E0397702000078000DADA4@prv-mh.provo.novell.com> Mime-Version: 1.0 Content-Type: multipart/mixed; boundary="===============2672054782717146033==" Return-path: In-Reply-To: <56E0397702000078000DADA4@prv-mh.provo.novell.com> List-Unsubscribe: , List-Post: List-Help: List-Subscribe: , Errors-To: xen-devel-bounces@lists.xen.org Sender: "Xen-devel" To: Quan Xu Cc: Kevin Tian , Jan Beulich , Suravee Suthikulpanit , "xen-devel@lists.xen.org" List-Id: xen-devel@lists.xenproject.org --===============2672054782717146033== Content-Type: multipart/signed; micalg=pgp-sha1; protocol="application/pgp-signature"; boundary="=-ttMkhWo2TtfKVwhzZMDZ" --=-ttMkhWo2TtfKVwhzZMDZ Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable On Wed, 2016-03-09 at 06:55 -0700, Jan Beulich wrote: > >=C2=A0 > > > > On 09.03.16 at 14:46, wrote: > > Now I am still not clear for this point- "this inconsistency might > > lead to=C2=A0 > > deadlock". > > I think it is similar to 'mixing interrupt disabled and enabled > > spinlocks is=C2=A0 > > something we disallow'. > > I hope you can give me an example about how to lead to deadlock.=C2=A0 > The implication from disabling interrupts while acquiring a lock > is that the lock is also being acquired by some interrupt > handler. If you mix acquire types, the one not disabling > interrupts is prone to be interrupted, and the interrupt trying > to get hold of the lock the same CPU already owns. >=20 Exactly. There are a few other nice writeup online as well. The most famous one, I guess, is this one from Linus (look at "Lesson 3: spinlocks revisited.") https://www.kernel.org/doc/Documentation/locking/spinlocks.txt And, of course, there's the comment inside check_lock(), in xen/common/spinlock.c, in Xen's codebase, where another example of how it could be dangerous to mix, even if multiple cpus are involved. Regards, Dario --=C2=A0 <> (Raistlin Majere) ----------------------------------------------------------------- Dario Faggioli, Ph.D, http://about.me/dario.faggioli Senior Software Engineer, Citrix Systems R&D Ltd., Cambridge (UK) --=-ttMkhWo2TtfKVwhzZMDZ Content-Type: application/pgp-signature; name="signature.asc" Content-Description: This is a digitally signed message part Content-Transfer-Encoding: 7bit -----BEGIN PGP SIGNATURE----- Version: GnuPG v2 iEYEABECAAYFAlbgNuwACgkQk4XaBE3IOsTdhgCglxS2+T9ctecmplQ2UGX7bDgI e+gAnjhu3H+6bmyhZ4Kb1eizj0Jl3lWH =N9gV -----END PGP SIGNATURE----- --=-ttMkhWo2TtfKVwhzZMDZ-- --===============2672054782717146033== Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: base64 Content-Disposition: inline X19fX19fX19fX19fX19fX19fX19fX19fX19fX19fX19fX19fX19fX19fX19fX18KWGVuLWRldmVs IG1haWxpbmcgbGlzdApYZW4tZGV2ZWxAbGlzdHMueGVuLm9yZwpodHRwOi8vbGlzdHMueGVuLm9y Zy94ZW4tZGV2ZWwK --===============2672054782717146033==--