From patchwork Fri Dec 13 19:37:32 2013 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Julien Grall X-Patchwork-Id: 22355 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 EF9DC202E2 for ; Fri, 13 Dec 2013 19:38:08 +0000 (UTC) Received: by mail-pd0-f199.google.com with SMTP id r10sf6527860pdi.10 for ; Fri, 13 Dec 2013 11:38:08 -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=SW4TgPpV9G7lmmJizxXQw3zZOJvpSKBGTl9vXH7g1iI=; b=F9zGV9aAo95Bvd679sKK9IajbGg3la1gPO8jduIJ8DxJxCWMoMK2Nt5g6F9m3M7PfM Rvzob35cR0lcxP/R+5acTXdw+DLPgr69b3CmoNSCa92bFMoERlYjviu8LfmQueJm30xv PsnOra+cJrIjbIs0kV7hmdyIC/CCKthnvIh4KxI3ny2eoDTlsQ4B/amcFGKYLOZHEN2r 8P0kSVr/IXyBKKVW9JPYgDhj/4sBv4FhNz5HlolYNcr0s+96gINPejCNBmDgkNL3LhuH 45xOmMcB+PlBWtXO8laEcv1rI+Ro+cET6T6/h/Wmm92qkfl2q9gs72hsI44hFFpNYH8L UJsg== X-Gm-Message-State: ALoCoQlZfUHb6z1jhVpV4umO+ojVWhU2DmfIsAqZ9h35jTxpy0kU8rNxzDVZSQRTbyPbf3UJdsKY X-Received: by 10.66.231.74 with SMTP id te10mr2622769pac.16.1386963488069; Fri, 13 Dec 2013 11:38:08 -0800 (PST) MIME-Version: 1.0 X-BeenThere: patchwork-forward@linaro.org Received: by 10.49.4.65 with SMTP id i1ls1141829qei.72.gmail; Fri, 13 Dec 2013 11:38:07 -0800 (PST) X-Received: by 10.52.171.227 with SMTP id ax3mr1642983vdc.34.1386963487940; Fri, 13 Dec 2013 11:38:07 -0800 (PST) Received: from mail-vc0-f178.google.com (mail-vc0-f178.google.com [209.85.220.178]) by mx.google.com with ESMTPS id gq10si1079663vdc.17.2013.12.13.11.38.07 for (version=TLSv1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Fri, 13 Dec 2013 11:38:07 -0800 (PST) Received-SPF: neutral (google.com: 209.85.220.178 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.178; Received: by mail-vc0-f178.google.com with SMTP id lh4so1615323vcb.37 for ; Fri, 13 Dec 2013 11:38:07 -0800 (PST) X-Received: by 10.220.58.1 with SMTP id e1mr2015983vch.0.1386963487779; Fri, 13 Dec 2013 11:38:07 -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 u4csp64184vcz; Fri, 13 Dec 2013 11:38:07 -0800 (PST) X-Received: by 10.15.82.136 with SMTP id a8mr4530731eez.81.1386963486900; Fri, 13 Dec 2013 11:38:06 -0800 (PST) Received: from mail-ee0-f52.google.com (mail-ee0-f52.google.com [74.125.83.52]) by mx.google.com with ESMTPS id w6si3129888eeg.195.2013.12.13.11.38.06 for (version=TLSv1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Fri, 13 Dec 2013 11:38:06 -0800 (PST) Received-SPF: neutral (google.com: 74.125.83.52 is neither permitted nor denied by best guess record for domain of julien.grall@linaro.org) client-ip=74.125.83.52; Received: by mail-ee0-f52.google.com with SMTP id d17so1073406eek.11 for ; Fri, 13 Dec 2013 11:38:06 -0800 (PST) X-Received: by 10.14.127.132 with SMTP id d4mr4655641eei.66.1386963486374; Fri, 13 Dec 2013 11:38:06 -0800 (PST) Received: from belegaer.uk.xensource.com. ([185.25.64.249]) by mx.google.com with ESMTPSA id m1sm10199792eeg.0.2013.12.13.11.38.05 for (version=TLSv1.2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Fri, 13 Dec 2013 11:38:05 -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 v4 02/11] xen/arm: Introduce steps in domain_relinquish_resource Date: Fri, 13 Dec 2013 19:37:32 +0000 Message-Id: <1386963461-6520-3-git-send-email-julien.grall@linaro.org> X-Mailer: git-send-email 1.7.10.4 In-Reply-To: <1386963461-6520-1-git-send-email-julien.grall@linaro.org> References: <1386963461-6520-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.178 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 0733c5e..53c9895 100644 --- a/xen/include/asm-arm/domain.h +++ b/xen/include/asm-arm/domain.h @@ -107,6 +107,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;