From mboxrd@z Thu Jan 1 00:00:00 1970 From: Dario Faggioli Subject: Re: Question about the usage of spinlock Date: Thu, 26 May 2016 18:11:14 +0200 Message-ID: <1464279074.21930.136.camel@citrix.com> References: Mime-Version: 1.0 Content-Type: multipart/mixed; boundary="===============5299816170908605046==" Return-path: In-Reply-To: List-Unsubscribe: , List-Post: List-Help: List-Subscribe: , Errors-To: xen-devel-bounces@lists.xen.org Sender: "Xen-devel" To: =?UTF-8?Q?=EC=A1=B0=ED=98=84=EA=B6=8C?= , xen-devel@lists.xen.org List-Id: xen-devel@lists.xenproject.org --===============5299816170908605046== Content-Type: multipart/signed; micalg=pgp-sha256; protocol="application/pgp-signature"; boundary="=-26OeIM9qcIpLMq8TdbKU" --=-26OeIM9qcIpLMq8TdbKU Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable On Thu, 2016-05-26 at 10:30 +0900, =EC=A1=B0=ED=98=84=EA=B6=8C wrote: > Hi > Hi, > I am studying xen 4.6.0 version now and wonder the usage of spinlock > which is located in free_heap_pages(xen/common/page_alloc. c) > As its memory setup is ahead of multicore initialization, spinlock > seems to be unnecessary during booting because it uses only single > core > spinlock looks required after multicore initialization finished and > when xen needs to free memory space during work > I'm not sure I understand the point you're trying to make. It's probably true that using spinlock is pointless before we actually have more than 1 CPU up and running. However, free_heap_pages() is called by other fucntions that are not necessarily only used during boot. For instance, it's called by=C2=A0free_domheap_pages(), which in its turn is called from functions that are used outside from the init path, when we are already SMP. > However i experimented not to use spin lock in free_heap_pages and > dom0(linux-kernel) was booted well. It does not cause any error using > internet or application program even reboot > That does not prove much, especially if you haven't actually tried using multiple guest or, in general, causing an actual concurrent execution of free_heap_pages(). However, even if you manage to construct a scenario where that happens, and things works, that also won't mean much, as the fact that in one particular case inconsistency due to races does not happen (or does not manifest), does not mean it can't happen, or it's not there already. All this, of course, provided I understood your question, which is something I'm not sure about. Dario --=20 <> (Raistlin Majere) ----------------------------------------------------------------- Dario Faggioli, Ph.D, http://about.me/dario.faggioli Senior Software Engineer, Citrix Systems R&D Ltd., Cambridge (UK) --=-26OeIM9qcIpLMq8TdbKU 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 iQIcBAABCAAGBQJXRyAjAAoJEBZCeImluHPuZ5oP/26CxVeFKNQ/fCI4226dIF9I DfLlsluVk9o8kl1D5rZN7G9lGDhv0HgsaKhPWqfwSG+5A/y1ujGfP4Upm1e+AcwX wDalYcxaf0Mn94gzN7QbGEr5kjv2I/ahh67edbO6f4zvNphcF9bw85cjL3vDcqpD 7BEH1yDmWitaQ/45bGfY1g74bL5YU3MaJSokHOLVCXlhU8u+xyU9OZmmXEDLEWMc RRvC5GZ+HPaMNDKIAFPic0PLvUaFeD3PwkwZJlFDGdcYqcuVqDjtIXlFdulN98M4 awLgUM+CcWaPwDksGHCjMR302Qoiz8w8ym9X7B7Og5sGgNh3qzI2/xfEV4xFOfHM /2RmTZp3rJL0Sf/DQWpLn4uFDV5dJ9Xyo/JcgLla9uMRnj8cbbQV+3aK8kPQG3+f 3d/dKKrc/67xUl/PCPt6Qs/zbIRFIyulNGiEVBj3ShG96IagjAXcB7cKXJijvnj1 syioHueSS9074x251rrf69M9OCXqAZizl4acXuvkl6CWjgijbttuYpi4krBpIxvu Br5hIKHju7+GYYOVRK0T1J0DTs+YfONHNe2jZrAGzxrrW5UYQotj5Zacx1jIiOQL VXfs9fKsoK2uSwiKc/fz1Z3ZCsbjCKCZuCPUPq/gq+nWH15rvtYqARF6PdzZtU6C uLxMTIBk7G7cFp65/m+A =LnDa -----END PGP SIGNATURE----- --=-26OeIM9qcIpLMq8TdbKU-- --===============5299816170908605046== Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: base64 Content-Disposition: inline X19fX19fX19fX19fX19fX19fX19fX19fX19fX19fX19fX19fX19fX19fX19fX18KWGVuLWRldmVs IG1haWxpbmcgbGlzdApYZW4tZGV2ZWxAbGlzdHMueGVuLm9yZwpodHRwOi8vbGlzdHMueGVuLm9y Zy94ZW4tZGV2ZWwK --===============5299816170908605046==--