xen-devel.lists.xenproject.org archive mirror
 help / color / mirror / Atom feed
From: Andrew Cooper <andrew.cooper3@citrix.com>
To: Julien Grall <julien.grall@linaro.org>
Cc: xen-devel@lists.xenproject.org, tim@xen.org,
	Ian Campbell <Ian.Campbell@citrix.com>,
	stefano.stabellini@citrix.com
Subject: Re: [PATCH v2] xen/arm: vcpu: Correctly release resource when the VCPU failed to initialized
Date: Fri, 2 May 2014 15:17:20 +0100	[thread overview]
Message-ID: <5363A8F0.2050109@citrix.com> (raw)
In-Reply-To: <5363A735.3020205@linaro.org>

On 02/05/14 15:09, Julien Grall wrote:
> On 05/02/2014 01:25 PM, Ian Campbell wrote:
>> On Wed, 2014-04-30 at 20:15 +0100, Julien Grall wrote:
>>> While I was adding new failing code at the end of the function, I've noticed
>>> that the vtimers are not freed which mess all the timers and will crash Xen
>>> quickly when the page will be reused.
>>>
>>> Currently neither vcpu_vgic_init nor vcpu_vtimer_init fail, so we
>>> are safe for now. With the new GICv3 code, the former function will be able
>>> to fail. This will result to a memory leak.
>>>
>>> Call vcpu_destroy if the initialization has failed. We also need to add a
>>> boolean to know if the vtimers are correctly setup as the timer common code
>>> doesn't have safe guard against removing non-initialized timer.
>>>
>>> Signed-off-by: Julien Grall <julien.grall@linaro.org>
>> I was about to acked + apply but it failed to build on arm64 with:
>>
>>         domain.c: In function 'alloc_vcpu_struct':
>>         /local/scratch/ianc/devel/committer.git/xen/include/xen/lib.h:19:31: error: static assertion failed: "!(sizeof(*v) > PAGE_SIZE)"
>>          #define BUILD_BUG_ON(cond) ({ _Static_assert(!(cond), "!(" #cond ")"); })
>>                                        ^
>>         domain.c:415:5: note: in expansion of macro 'BUILD_BUG_ON'
>>              BUILD_BUG_ON(sizeof(*v) > PAGE_SIZE);
>>              ^
>> struct arch_vcpu is apparently now too large.
> Hmmm... I'm not sure what is the best solution. Can:
> 	1) Allocate 2 pages for the VCPU structure
> 	2) Allocate vgic structure outside.
>
> Any opinions?
>
> Regards,
>

2)

The reason structs vcpu/domain were reduced to this size to was avoid
needing multi-page allocations, which risk allocation failures on
systems with sufficiently fragmented memory.

~Andrew

  reply	other threads:[~2014-05-02 14:17 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-04-30 19:15 [PATCH v2] xen/arm: vcpu: Correctly release resource when the VCPU failed to initialized Julien Grall
2014-05-02 12:25 ` Ian Campbell
2014-05-02 14:09   ` Julien Grall
2014-05-02 14:17     ` Andrew Cooper [this message]
2014-05-02 15:15       ` Ian Campbell
2014-05-02 15:27         ` Ian Campbell
2014-05-02 15:36           ` Julien Grall
2014-05-07 15:09             ` Julien Grall
2014-05-21 12:39   ` Julien Grall
2014-06-02 14:39     ` Ian Campbell

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=5363A8F0.2050109@citrix.com \
    --to=andrew.cooper3@citrix.com \
    --cc=Ian.Campbell@citrix.com \
    --cc=julien.grall@linaro.org \
    --cc=stefano.stabellini@citrix.com \
    --cc=tim@xen.org \
    --cc=xen-devel@lists.xenproject.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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).