Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-5.8 required=3.0 tests=HEADER_FROM_DIFFERENT_DOMAINS, HTML_MESSAGE,MAILING_LIST_MULTI,MENTIONS_GIT_HOSTING,SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 50ACAC4321A for ; Mon, 10 Jun 2019 19:58:38 +0000 (UTC) Received: from lists.xenproject.org (lists.xenproject.org [192.237.175.120]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id 2FB66206E0 for ; Mon, 10 Jun 2019 19:58:38 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 2FB66206E0 Authentication-Results: mail.kernel.org; dmarc=none (p=none dis=none) header.from=cert.pl Authentication-Results: mail.kernel.org; spf=none smtp.mailfrom=xen-devel-bounces@lists.xenproject.org Received: from localhost ([127.0.0.1] helo=lists.xenproject.org) by lists.xenproject.org with esmtp (Exim 4.89) (envelope-from ) id 1haQQm-0002hk-AM; Mon, 10 Jun 2019 19:58:12 +0000 Received: from us1-rack-dfw2.inumbo.com ([104.130.134.6]) by lists.xenproject.org with esmtp (Exim 4.89) (envelope-from ) id 1haQQl-0002hf-34 for xen-devel@lists.xenproject.org; Mon, 10 Jun 2019 19:58:11 +0000 X-Inumbo-ID: 1187e262-8bba-11e9-8980-bc764e045a96 Received: from bagnar.nask.net.pl (unknown [195.187.242.196]) by us1-rack-dfw2.inumbo.com (Halon) with ESMTPS id 1187e262-8bba-11e9-8980-bc764e045a96; Mon, 10 Jun 2019 19:58:09 +0000 (UTC) Received: from bagnar.nask.net.pl (unknown [172.16.9.10]) by bagnar.nask.net.pl (Postfix) with ESMTP id 21D93A21DF; Mon, 10 Jun 2019 21:58:08 +0200 (CEST) Received: from localhost (localhost [127.0.0.1]) by bagnar.nask.net.pl (Postfix) with ESMTP id 1BBACA2167; Mon, 10 Jun 2019 21:58:07 +0200 (CEST) Received: from bagnar.nask.net.pl ([127.0.0.1]) by localhost (bagnar.nask.net.pl [127.0.0.1]) (amavisd-new, port 10032) with ESMTP id RpLQvEU_2QuM; Mon, 10 Jun 2019 21:58:06 +0200 (CEST) Received: from localhost (localhost [127.0.0.1]) by bagnar.nask.net.pl (Postfix) with ESMTP id 65F14A1BBE; Mon, 10 Jun 2019 21:58:06 +0200 (CEST) X-Virus-Scanned: amavisd-new at bagnar.nask.net.pl Received: from bagnar.nask.net.pl ([127.0.0.1]) by localhost (bagnar.nask.net.pl [127.0.0.1]) (amavisd-new, port 10026) with ESMTP id VQ12WINW185l; Mon, 10 Jun 2019 21:58:06 +0200 (CEST) Received: from belindir.nask.net.pl (belindir-ext.nask.net.pl [195.187.242.210]) by bagnar.nask.net.pl (Postfix) with ESMTP id 3EC42A1B56; Mon, 10 Jun 2019 21:58:06 +0200 (CEST) Received: from localhost (localhost [127.0.0.1]) by belindir.nask.net.pl (Postfix) with ESMTP id 3BBF1216B6; Mon, 10 Jun 2019 21:57:36 +0200 (CEST) Received: from belindir.nask.net.pl ([127.0.0.1]) by localhost (belindir.nask.net.pl [127.0.0.1]) (amavisd-new, port 10032) with ESMTP id R0h6tXVrwM0A; Mon, 10 Jun 2019 21:57:35 +0200 (CEST) Received: from localhost (localhost [127.0.0.1]) by belindir.nask.net.pl (Postfix) with ESMTP id 248F521706; Mon, 10 Jun 2019 21:57:35 +0200 (CEST) X-Virus-Scanned: amavisd-new at belindir.nask.net.pl Received: from belindir.nask.net.pl ([127.0.0.1]) by localhost (belindir.nask.net.pl [127.0.0.1]) (amavisd-new, port 10026) with ESMTP id RpUKPz1GIZKN; Mon, 10 Jun 2019 21:57:35 +0200 (CEST) Received: from [195.187.238.217] (unknown [195.187.238.217]) by belindir.nask.net.pl (Postfix) with ESMTPSA id 0112A216B6; Mon, 10 Jun 2019 21:57:34 +0200 (CEST) To: Anthony PERARD References: <1050197223.47376247.1559909190275.JavaMail.zimbra@cert.pl> <20190610094143.GA30852@perard.uk.xensource.com> From: =?UTF-8?Q?Micha=c5=82_Leszczy=c5=84ski?= Openpgp: preference=signencrypt Autocrypt: addr=michal.leszczynski@cert.pl; keydata= mQINBFubrQQBEADOpFn1BA3poV6QnE8EWxuLut9s3z6fyuLZWglWhm2BEki7OSqPVhc1DAEh XmonG73h7iMBhy9j+B0+YquxqWRQRLlF9kZzfawsPwabXj4pIGT2pDF1YQM5b2Y1x63CS49s 1c/KfA1TjqgoOEl/crX351Y4NlyEBWzlS7KW4R73zr/S9r7lEO3C8QtCh6K2BxEBUPE9Bmy8 EdvLnH3TeBtuM7wLvUdfIyLFJrQcRy+EceKKK5s8ZJtfFTJE1+skJovJn8uo46vp2NlFxX8s gFEeW0X+YcDOQn3KU02w6HA9eBj7Fkl9DaQqx+dAORw6Q0e/0MXSs1tfblwk1cEQXA1VU2oW F7mroKWufRTPpewTpwR00sO/9uYRJs7kPNbJ8f1c4UpclvimqpBw4Tr8RSN3puZ+BJztzNOl a/kklCmRRRyEI91JvIeNTSBdHwCEAzCP9mmBgmD0sRCLXjtd4Qz/BBr0v3eQGePqPvBqylDc VywVlELyWnf1qkJuaULo6opq43sE0pD0OsIH2Ngr1I2Abzix2AGHcLU5KHqJOf6q7lal+O36 TKoDUxHKMpHLx4sni//kW41GYe7C7oKw2ACQtlpJAch8EUZrSxotSNvQJkt6QgKWckMradPf c99sStqeCF9xC2AW1CaXk7rb8pyljl/wjkyEnzO9wr2I+NCm+wARAQABtDFNaWNoYcWCIExl c3pjennFhHNraSA8bWljaGFsLmxlc3pjenluc2tpQGNlcnQucGw+iQJUBBMBCgA+FiEEi8ZW qhvgeJY9d57ZKtZpXG3wbKoFAlubrQQCGyMFCQlmAYAFCwkIBwIGFQoJCAsCBBYCAwECHgEC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23OW8EtrZI2htgwcAAw pnKSUZgLdIxAmMNsRA== Message-ID: Date: Mon, 10 Jun 2019 21:57:34 +0200 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:60.0) Gecko/20100101 Thunderbird/60.7.0 MIME-Version: 1.0 In-Reply-To: <20190610094143.GA30852@perard.uk.xensource.com> Content-Language: en-US Subject: Re: [Xen-devel] Relevance of global lock (/var/lock/xl) in xl tool X-BeenThere: xen-devel@lists.xenproject.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: Xen developer discussion List-Unsubscribe: , List-Post: List-Help: List-Subscribe: , Cc: xen-devel@lists.xenproject.org Content-Type: multipart/mixed; boundary="===============1502503141910297454==" Errors-To: xen-devel-bounces@lists.xenproject.org Sender: "Xen-devel" This is a multi-part message in MIME format. --===============1502503141910297454== Content-Type: multipart/alternative; boundary="------------656EC655B41CDEA7C4511329" Content-Language: en-US This is a multi-part message in MIME format. --------------656EC655B41CDEA7C4511329 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable Hello, I've tested the scenario with restoring too many domains having lock commented out. It turns out that in case when there is no memory left for XEN to allocate, all pending /xl restore/ commands will simply fail with an internal error. As far as I understand, it's not going to do any damage unless I request too much memory? If so, then there is some place for improvement, i.e. to make xl acquire the lock, allocate memory, release the lock and then start restoring the domain state. Maybe I could provide some pull request if I would manage to implement such behavior. Best regards, Micha=C5=82 Leszczy=C5=84ski On 10.06.2019 11:41, Anthony PERARD wrote: > On Fri, Jun 07, 2019 at 02:06:30PM +0200, Micha=C5=82 Leszczy=C5=84ski = wrote: >> Hello, > Hi, > >> when either "xl restore" or "xl create" command is invoked, a global l= ock is acquired here: >> >> https://github.com/xen-project/xen/blob/master/tools/xl/xl_vmcontrol.c= #L876 >> >> I'm trying to figure out what is the exact importance of this lock? Is= it really critical for XL operation? I have a pretty powerful machine on= which I want to run a few dozen of short-lived VMs. This lock is serious= ly slowing me down, not letting to restore more than one domain at once. = Turns out that everything still works fine (and much faster) when I comme= nt-out the lock in the abovementioned place, but I'm not sure if it's a c= orrect impression. >> >> Does anyone know if there is a situation in which Xen would screw up w= ithout this lock? > Here is the reason for the lock: > https://xenbits.xen.org/gitweb/?p=3Dxen.git;a=3Dcommit;h=3Dea4dce89d478= d62341cd2f9d8944e215f7086144 > > xl: free memory before building a domain > Free the needed amount of memory before proceeding with the domain > build. > Use a filelock to prevent other xl instances from conflicting during > this operation. > > So there are probably configurations where the lock isn't useful, or > there are better ways to reserve memory for domain creation. > --=20 Pozdrawiam Micha=C5=82 Leszczy=C5=84ski CERT Polska/NASK +48 532 461 124 --------------656EC655B41CDEA7C4511329 Content-Type: text/html; charset=utf-8 Content-Transfer-Encoding: quoted-printable

Hello,

I've tested the scenario with restoring too many domains having lock commented out. It turns out that in case when there is no memory left for XEN to allocate, all pending xl restore commands will simply fail with an internal error.

As far as I understand, it's not going to do any damage unless I request too much memory?

If so, then there is some place for improvement, i.e. to make xl acquire the lock, allocate memory, release the lock and then start restoring the domain state. Maybe I could provide some pull request if I would manage to implement such behavior.


Best regards,
Micha=C5=82 Leszczy=C5=84ski


On 10.06.2019 11:41, Anthony PERARD wrote:
On Fri, Jun 07, 2019 at 02:0=
6:30PM +0200, Micha=C5=82 Leszczy=C5=84ski wrote:
Hello,
Hi,

when either "xl restore" o=
r "xl create" command is invoked, a global lock is acquired here:

https://github.com/xen-pro=
ject/xen/blob/master/tools/xl/xl_vmcontrol.c#L876

I'm trying to figure out what is the exact importance of this lock? Is it=
 really critical for XL operation? I have a pretty powerful machine on wh=
ich I want to run a few dozen of short-lived VMs. This lock is seriously =
slowing me down, not letting to restore more than one domain at once. Tur=
ns out that everything still works fine (and much faster) when I comment-=
out the lock in the abovementioned place, but I'm not sure if it's a corr=
ect impression.

Does anyone know if there is a situation in which Xen would screw up with=
out this lock?
Here is the reason for the lock:
ht=
tps://xenbits.xen.org/gitweb/?p=3Dxen.git;a=3Dcommit;h=3Dea4dce89d478d623=
41cd2f9d8944e215f7086144

  xl: free memory before building a domain
  Free the needed amount of memory before proceeding with the domain
  build.
  Use a filelock to prevent other xl instances from conflicting during
  this operation.

So there are probably configurations where the lock isn't useful, or
there are better ways to reserve memory for domain creation.

--=20
Pozdrawiam
Micha=C5=82 Leszczy=C5=84ski
CERT Polska/NASK
+48 532 461 124
--------------656EC655B41CDEA7C4511329-- --===============1502503141910297454== Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: base64 Content-Disposition: inline X19fX19fX19fX19fX19fX19fX19fX19fX19fX19fX19fX19fX19fX19fX19fX18KWGVuLWRldmVs IG1haWxpbmcgbGlzdApYZW4tZGV2ZWxAbGlzdHMueGVucHJvamVjdC5vcmcKaHR0cHM6Ly9saXN0 cy54ZW5wcm9qZWN0Lm9yZy9tYWlsbWFuL2xpc3RpbmZvL3hlbi1kZXZlbA== --===============1502503141910297454==--