From patchwork Tue Dec 10 14:18:13 2013 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Julien Grall X-Patchwork-Id: 22212 Return-Path: X-Original-To: linaro@patches.linaro.org Delivered-To: linaro@patches.linaro.org Received: from mail-pd0-f199.google.com (mail-pd0-f199.google.com [209.85.192.199]) by ip-10-151-82-157.ec2.internal (Postfix) with ESMTPS id EB6B823FD8 for ; Tue, 10 Dec 2013 14:18:35 +0000 (UTC) Received: by mail-pd0-f199.google.com with SMTP id r10sf23145107pdi.10 for ; Tue, 10 Dec 2013 06:18:35 -0800 (PST) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:mime-version:delivered-to:from:to:cc:subject :date:message-id:in-reply-to:references:x-original-sender :x-original-authentication-results:precedence:mailing-list:list-id :list-post:list-help:list-archive:list-unsubscribe; bh=il9krhujFJo9re+Yvv9R0RQZ0HjYD+8tsiRxeTWM39A=; b=kGBaoANRBLqIIVFb+Eh5DHb5JA/cB3VNMPNop3jgVjoRMu/AIGwdnoWCugFZ32NjuF 0ZJCdmBpNpcQffCG5CX/cSHamjBDX5Lka2xDvZjgiFjRFXUBB72IBTLQmOJxeSzL6TDq aA5Qm3G5JDYQJBm3HU27p1cUZIbWkNeH4ePhsEhfJhCTt1YTe935sHQFn022ZAWaUidd FtGXNINNahtY8rGc2tpnZEUASFw6NqVftBPvnHmdYD1qAIAO0jhG0RRLOQqFCDhQNhwj 0mCisJIrPvQmQTX7093umFbg8faDIcC7ZLiLwY3OKCKd29IMpxggP0Lej80THHHMfRXH mSNA== X-Gm-Message-State: ALoCoQkhgF2CPPmmtqVEDATPsElOXzKkxsZkkaUJ5obKszsWHNShch4v9FXGEIqFhwebFJ1pTjDu X-Received: by 10.66.150.37 with SMTP id uf5mr960372pab.46.1386685114944; Tue, 10 Dec 2013 06:18:34 -0800 (PST) MIME-Version: 1.0 X-BeenThere: patchwork-forward@linaro.org Received: by 10.49.73.69 with SMTP id j5ls2538445qev.48.gmail; Tue, 10 Dec 2013 06:18:34 -0800 (PST) X-Received: by 10.58.128.163 with SMTP id np3mr18675veb.62.1386685114767; Tue, 10 Dec 2013 06:18:34 -0800 (PST) Received: from mail-vc0-f171.google.com (mail-vc0-f171.google.com [209.85.220.171]) by mx.google.com with ESMTPS id gs7si5174131veb.129.2013.12.10.06.18.34 for (version=TLSv1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Tue, 10 Dec 2013 06:18:34 -0800 (PST) Received-SPF: neutral (google.com: 209.85.220.171 is neither permitted nor denied by best guess record for domain of patch+caf_=patchwork-forward=linaro.org@linaro.org) client-ip=209.85.220.171; Received: by mail-vc0-f171.google.com with SMTP id ik5so4588500vcb.16 for ; Tue, 10 Dec 2013 06:18:34 -0800 (PST) X-Received: by 10.221.49.135 with SMTP id va7mr21287vcb.50.1386685114671; Tue, 10 Dec 2013 06:18:34 -0800 (PST) X-Forwarded-To: patchwork-forward@linaro.org X-Forwarded-For: patch@linaro.org patchwork-forward@linaro.org Delivered-To: patches@linaro.org Received: by 10.220.174.196 with SMTP id u4csp191403vcz; Tue, 10 Dec 2013 06:18:34 -0800 (PST) X-Received: by 10.180.86.198 with SMTP id r6mr19285355wiz.27.1386685113079; Tue, 10 Dec 2013 06:18:33 -0800 (PST) Received: from mail-wg0-f42.google.com (mail-wg0-f42.google.com [74.125.82.42]) by mx.google.com with ESMTPS id gi4si1016362wic.56.2013.12.10.06.18.32 for (version=TLSv1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Tue, 10 Dec 2013 06:18:33 -0800 (PST) Received-SPF: neutral (google.com: 74.125.82.42 is neither permitted nor denied by best guess record for domain of julien.grall@linaro.org) client-ip=74.125.82.42; Received: by mail-wg0-f42.google.com with SMTP id a1so4715081wgh.3 for ; Tue, 10 Dec 2013 06:18:32 -0800 (PST) X-Received: by 10.180.74.230 with SMTP id x6mr19373972wiv.29.1386685112646; Tue, 10 Dec 2013 06:18:32 -0800 (PST) Received: from belegaer.uk.xensource.com. ([185.25.64.249]) by mx.google.com with ESMTPSA id nb16sm5556779wic.0.2013.12.10.06.18.31 for (version=TLSv1.2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Tue, 10 Dec 2013 06:18:31 -0800 (PST) From: Julien Grall To: xen-devel@lists.xenproject.org Cc: patches@linaro.org, ian.campbell@citrix.com, tim@xen.org, stefano.stabellini@citrix.com, Julien Grall Subject: [PATCH v3 01/10] xen/arm: Introduce steps in domain_relinquish_resource Date: Tue, 10 Dec 2013 14:18:13 +0000 Message-Id: <1386685102-563-2-git-send-email-julien.grall@linaro.org> X-Mailer: git-send-email 1.7.10.4 In-Reply-To: <1386685102-563-1-git-send-email-julien.grall@linaro.org> References: <1386685102-563-1-git-send-email-julien.grall@linaro.org> X-Removed-Original-Auth: Dkim didn't pass. X-Original-Sender: julien.grall@linaro.org X-Original-Authentication-Results: mx.google.com; spf=neutral (google.com: 209.85.220.171 is neither permitted nor denied by best guess record for domain of patch+caf_=patchwork-forward=linaro.org@linaro.org) smtp.mail=patch+caf_=patchwork-forward=linaro.org@linaro.org Precedence: list Mailing-list: list patchwork-forward@linaro.org; contact patchwork-forward+owners@linaro.org List-ID: X-Google-Group-Id: 836684582541 List-Post: , List-Help: , List-Archive: List-Unsubscribe: , In a later patch, a new step will be added. It will avoid to check every step when the function was preempted. Signed-off-by: Julien Grall Acked-by: Ian Campbell --- Changes in v2: - Introduce the patch --- xen/arch/arm/domain.c | 37 ++++++++++++++++++++++++++++++------- xen/include/asm-arm/domain.h | 8 ++++++++ 2 files changed, 38 insertions(+), 7 deletions(-) diff --git a/xen/arch/arm/domain.c b/xen/arch/arm/domain.c index 67c65c3..1590708 100644 --- a/xen/arch/arm/domain.c +++ b/xen/arch/arm/domain.c @@ -497,6 +497,8 @@ int arch_domain_create(struct domain *d, unsigned int domcr_flags) { int rc; + d->arch.relmem = RELMEM_not_started; + /* Idle domains do not need this setup */ if ( is_idle_domain(d) ) return 0; @@ -696,15 +698,36 @@ int domain_relinquish_resources(struct domain *d) { int ret = 0; - ret = relinquish_memory(d, &d->xenpage_list); - if ( ret ) - return ret; + switch ( d->arch.relmem ) + { + case RELMEM_not_started: + d->arch.relmem = RELMEM_xen; + /* Falltrough */ - ret = relinquish_memory(d, &d->page_list); - if ( ret ) - return ret; + case RELMEM_xen: + ret = relinquish_memory(d, &d->xenpage_list); + if ( ret ) + return ret; - return ret; + d->arch.relmem = RELMEM_page; + /* Fallthrough */ + + case RELMEM_page: + ret = relinquish_memory(d, &d->page_list); + if ( ret ) + return ret; + + d->arch.relmem = RELMEM_done; + /* Fallthrough */ + + case RELMEM_done: + break; + + default: + BUG(); + } + + return 0; } void arch_dump_domain_info(struct domain *d) diff --git a/xen/include/asm-arm/domain.h b/xen/include/asm-arm/domain.h index 8ebee3e..922eda3 100644 --- a/xen/include/asm-arm/domain.h +++ b/xen/include/asm-arm/domain.h @@ -70,6 +70,14 @@ struct arch_domain struct hvm_domain hvm_domain; xen_pfn_t *grant_table_gpfn; + /* Continuable domain_relinquish_resources(). */ + enum { + RELMEM_not_started, + RELMEM_xen, + RELMEM_page, + RELMEM_done, + } relmem; + /* Virtual CPUID */ uint32_t vpidr;