From patchwork Mon Dec 16 17:37:23 2013 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Julien Grall X-Patchwork-Id: 22530 Return-Path: X-Original-To: linaro@patches.linaro.org Delivered-To: linaro@patches.linaro.org Received: from mail-ie0-f200.google.com (mail-ie0-f200.google.com [209.85.223.200]) by ip-10-151-82-157.ec2.internal (Postfix) with ESMTPS id A0EBC23FC6 for ; Mon, 16 Dec 2013 17:37:40 +0000 (UTC) Received: by mail-ie0-f200.google.com with SMTP id at1sf18838075iec.7 for ; Mon, 16 Dec 2013 09:37:40 -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=KUPF2FuPm0w4ZeqJ8btgGxX2ih9jgvohI/kNs02mirWDUx2E55hFEy2ewdkdcl+ECg Tsha0uLLRzLSHxwpw+arpUtVIvTgxnK0hSQG/6ZHfe5hy6T65TwLlItLNpYr+Ud11Utk 3o9RV5QKMcxObejBPl18WXSgnQAjOX7RUvCg1kSEXogH9Fl/1M2VUWwma/nSg9aUrSas ZPxfCaaQ8fjyWBe5e+EIzqQIGJS6KpWMZ0BwbSL9KNPHaWBy4P843+6kaOuHYHVe1vdS heMzxjMYsgzJxuJpbl0ib8WPhYQBeZe+76j0Ugo7NlFlUSd+l0rUMAW3B+phVEFlyX3n rdQQ== X-Gm-Message-State: ALoCoQmcpyc6fokctoq8T39DKV+nLmR6J7Ie4IeDl+Aaaq1nQUip+HBZCrDBK4cefIlhkE4mmagi X-Received: by 10.42.240.19 with SMTP id ky19mr5678737icb.4.1387215459980; Mon, 16 Dec 2013 09:37:39 -0800 (PST) MIME-Version: 1.0 X-BeenThere: patchwork-forward@linaro.org Received: by 10.49.73.40 with SMTP id i8ls2118963qev.12.gmail; Mon, 16 Dec 2013 09:37:39 -0800 (PST) X-Received: by 10.52.158.170 with SMTP id wv10mr68628vdb.77.1387215459797; Mon, 16 Dec 2013 09:37:39 -0800 (PST) Received: from mail-vb0-f42.google.com (mail-vb0-f42.google.com [209.85.212.42]) by mx.google.com with ESMTPS id o3si4161945ves.48.2013.12.16.09.37.39 for (version=TLSv1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Mon, 16 Dec 2013 09:37:39 -0800 (PST) Received-SPF: neutral (google.com: 209.85.212.42 is neither permitted nor denied by best guess record for domain of patch+caf_=patchwork-forward=linaro.org@linaro.org) client-ip=209.85.212.42; Received: by mail-vb0-f42.google.com with SMTP id w5so3378456vbf.15 for ; Mon, 16 Dec 2013 09:37:39 -0800 (PST) X-Received: by 10.52.230.35 with SMTP id sv3mr3893582vdc.27.1387215459723; Mon, 16 Dec 2013 09:37:39 -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 u4csp6106vcz; Mon, 16 Dec 2013 09:37:39 -0800 (PST) X-Received: by 10.14.182.199 with SMTP id o47mr18082020eem.7.1387215458748; Mon, 16 Dec 2013 09:37:38 -0800 (PST) Received: from mail-ee0-f50.google.com (mail-ee0-f50.google.com [74.125.83.50]) by mx.google.com with ESMTPS id r9si1363129eeo.86.2013.12.16.09.37.38 for (version=TLSv1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Mon, 16 Dec 2013 09:37:38 -0800 (PST) Received-SPF: neutral (google.com: 74.125.83.50 is neither permitted nor denied by best guess record for domain of julien.grall@linaro.org) client-ip=74.125.83.50; Received: by mail-ee0-f50.google.com with SMTP id c41so2367494eek.23 for ; Mon, 16 Dec 2013 09:37:38 -0800 (PST) X-Received: by 10.14.251.132 with SMTP id b4mr18399903ees.78.1387215458054; Mon, 16 Dec 2013 09:37:38 -0800 (PST) Received: from belegaer.uk.xensource.com. ([185.25.64.249]) by mx.google.com with ESMTPSA id e3sm44674680eeg.11.2013.12.16.09.37.36 for (version=TLSv1.2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Mon, 16 Dec 2013 09:37:36 -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 v5 01/10] xen/arm: Introduce steps in domain_relinquish_resource Date: Mon, 16 Dec 2013 17:37:23 +0000 Message-Id: <1387215452-10951-2-git-send-email-julien.grall@linaro.org> X-Mailer: git-send-email 1.7.10.4 In-Reply-To: <1387215452-10951-1-git-send-email-julien.grall@linaro.org> References: <1387215452-10951-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.212.42 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;