xen-devel.lists.xenproject.org archive mirror
 help / color / mirror / Atom feed
* Question about the usage of spinlock
       [not found]                 ` <CA+CgW8dOzcuGLyCd6EZv4hDB5ArPKSBdrLcSTpXgUuZ_R65-PA@mail.gmail.com>
@ 2016-05-26  1:30                   ` 조현권
  2016-05-26 11:07                     ` Xu, Quan
  2016-05-26 16:11                     ` Dario Faggioli
  0 siblings, 2 replies; 4+ messages in thread
From: 조현권 @ 2016-05-26  1:30 UTC (permalink / raw)
  To: xen-devel


[-- Attachment #1.1: Type: text/plain, Size: 702 bytes --]

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

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

Are therr any special reason to use spinlock?

My experiment environment was ODROID-XU4 which uses arm architecture

Thabk you

[-- Attachment #1.2: Type: text/html, Size: 832 bytes --]

[-- Attachment #2: Type: text/plain, Size: 126 bytes --]

_______________________________________________
Xen-devel mailing list
Xen-devel@lists.xen.org
http://lists.xen.org/xen-devel

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: Question about the usage of spinlock
  2016-05-26  1:30                   ` Question about the usage of spinlock 조현권
@ 2016-05-26 11:07                     ` Xu, Quan
  2016-05-26 14:50                       ` Julien Grall
  2016-05-26 16:11                     ` Dario Faggioli
  1 sibling, 1 reply; 4+ messages in thread
From: Xu, Quan @ 2016-05-26 11:07 UTC (permalink / raw)
  To: chkwon91@gmail.com, xen-devel@lists.xen.org

On May 26, 2016 9:31 AM, 조현권 <chkwon91@gmail.com> wrote:
> 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
> 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
> Are therr any special reason to use spinlock?
> My experiment environment was ODROID-XU4 which uses arm architecture

Ah, you can try to test more for DomU..
Quan
_______________________________________________
Xen-devel mailing list
Xen-devel@lists.xen.org
http://lists.xen.org/xen-devel

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: Question about the usage of spinlock
  2016-05-26 11:07                     ` Xu, Quan
@ 2016-05-26 14:50                       ` Julien Grall
  0 siblings, 0 replies; 4+ messages in thread
From: Julien Grall @ 2016-05-26 14:50 UTC (permalink / raw)
  To: Xu, Quan, chkwon91@gmail.com, xen-devel@lists.xen.org

Hello,

On 26/05/2016 12:07, Xu, Quan wrote:
> On May 26, 2016 9:31 AM, 조현권 <chkwon91@gmail.com> wrote:
>> 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
>> 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
>> Are therr any special reason to use spinlock?
>> My experiment environment was ODROID-XU4 which uses arm architecture
>
> Ah, you can try to test more for DomU..

Please try to be helpful when answering to a question. I.e provide 
comment which will help to understand the need (or not) of spinlock.

In this case, booting a single domU will unlikely exacerbate the need of 
spinlock because you need concurrent call to {alloc,free}_heap_pages. 
The easiest way would be creating/destroying multiple guests at the same 
time.

Anyway, Xen will need to manage memory (with {alloc,free}_heap_pages) 
after boot, such as allocating/freeing internal structure associated to 
a domain/vCPU. Search for {alloc,free}_xenheap_pages, which are helpers 
for *_heap_pages.

After Xen has finished to boot, the memory can be managed from any CPUs.
So the code in those functions need to be protected against concurrent 
access.

Regards,

-- 
Julien Grall

_______________________________________________
Xen-devel mailing list
Xen-devel@lists.xen.org
http://lists.xen.org/xen-devel

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: Question about the usage of spinlock
  2016-05-26  1:30                   ` Question about the usage of spinlock 조현권
  2016-05-26 11:07                     ` Xu, Quan
@ 2016-05-26 16:11                     ` Dario Faggioli
  1 sibling, 0 replies; 4+ messages in thread
From: Dario Faggioli @ 2016-05-26 16:11 UTC (permalink / raw)
  To: 조현권, xen-devel


[-- Attachment #1.1: Type: text/plain, Size: 1946 bytes --]

On Thu, 2016-05-26 at 10:30 +0900, 조현권 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 free_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
-- 
<<This happens because I choose it to happen!>> (Raistlin Majere)
-----------------------------------------------------------------
Dario Faggioli, Ph.D, http://about.me/dario.faggioli
Senior Software Engineer, Citrix Systems R&D Ltd., Cambridge (UK)


[-- Attachment #1.2: This is a digitally signed message part --]
[-- Type: application/pgp-signature, Size: 819 bytes --]

[-- Attachment #2: Type: text/plain, Size: 126 bytes --]

_______________________________________________
Xen-devel mailing list
Xen-devel@lists.xen.org
http://lists.xen.org/xen-devel

^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2016-05-26 16:11 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
     [not found] <CA+CgW8eeCG2DZv6s_Ozs3OsJpzVwkVOQP-NB+Yn8O7RT5beByw@mail.gmail.com>
     [not found] ` <CA+CgW8dadfhqptZMmMmb196tbA3z52OJS52ZRsX2P8Pjrmz=pA@mail.gmail.com>
     [not found]   ` <CA+CgW8d1UOSR2EK3Fe_y9BGhe3vTe4vaAqt8Rhcw+qKth3XCbw@mail.gmail.com>
     [not found]     ` <CA+CgW8dD9A+pMHhHKvieunTk6T4cH5X8DObcgjTruBM2bW+v9A@mail.gmail.com>
     [not found]       ` <CA+CgW8dic4RLoW2-S5QQHNKYO_y=7_=Dw+hbGX2myOnSeXbapA@mail.gmail.com>
     [not found]         ` <CA+CgW8cJpBV4owXg51rsDOX_XoJjtMDtvgDn19-Mhs096MMJdA@mail.gmail.com>
     [not found]           ` <CA+CgW8e2qMULD=GiiwONumwV4UMUh6hha3MXESuPhHZ_RGyzrQ@mail.gmail.com>
     [not found]             ` <CA+CgW8cqN4W93h8Y3XNEq5oVynq7gYosTqQz5Kt6Pdfp=Cu2xg@mail.gmail.com>
     [not found]               ` <CA+CgW8d+u4KzOR=PDqKfSwztKGh-By6eiCremVLKMEv6tWMQOw@mail.gmail.com>
     [not found]                 ` <CA+CgW8dOzcuGLyCd6EZv4hDB5ArPKSBdrLcSTpXgUuZ_R65-PA@mail.gmail.com>
2016-05-26  1:30                   ` Question about the usage of spinlock 조현권
2016-05-26 11:07                     ` Xu, Quan
2016-05-26 14:50                       ` Julien Grall
2016-05-26 16:11                     ` Dario Faggioli

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).