From patchwork Tue Dec 17 16:27:49 2013 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Julien Grall X-Patchwork-Id: 22598 Return-Path: X-Original-To: linaro@patches.linaro.org Delivered-To: linaro@patches.linaro.org Received: from mail-gg0-f199.google.com (mail-gg0-f199.google.com [209.85.161.199]) by ip-10-151-82-157.ec2.internal (Postfix) with ESMTPS id E897723FC6 for ; Tue, 17 Dec 2013 16:28:09 +0000 (UTC) Received: by mail-gg0-f199.google.com with SMTP id e26sf429471gga.2 for ; Tue, 17 Dec 2013 08:28:09 -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=jPo+vtfxofExgQuThVBkBMd7rYgbpyl9ZJhv1vpNlMHkdZyplDIM5xhJ6QdzNxbyTn P7ZL0c20UPAAIlPBqbVGj/6P/CNOx7HKVSEXv9LlsKOu2CDd9wBQUuFR4YhvPLIUcfRA CpCAYhvtQM2cKz2ZHIoo+D0G8oMVu+DPhXteS+l10/bqcRKVyi/ziPuH/d7NnJxJoD87 6nslVN3vkzrwi7Kbqx1Bh+7hqpkhkyH+r9unX/2mzDv5kjVLp9TZnx6HMrMOCzDsrj9c HpqgLveEyPGJ/bPrK6XzLvS6UqyMcLwxiu2jDgr0t9yX9i856LgvEnyj7UCUvv7Z7SWS vCCg== X-Gm-Message-State: ALoCoQlaUHqaxj+iyGSzG1MOKp2fT6wr2oHZraU2zt1z4aVTzzg/jTnJGglKGG2C8r2wr5SLSSqo X-Received: by 10.58.50.202 with SMTP id e10mr1013962veo.41.1387297689706; Tue, 17 Dec 2013 08:28:09 -0800 (PST) MIME-Version: 1.0 X-BeenThere: patchwork-forward@linaro.org Received: by 10.49.49.10 with SMTP id q10ls2688444qen.0.gmail; Tue, 17 Dec 2013 08:28:09 -0800 (PST) X-Received: by 10.52.27.170 with SMTP id u10mr796080vdg.74.1387297689596; Tue, 17 Dec 2013 08:28:09 -0800 (PST) Received: from mail-ve0-f174.google.com (mail-ve0-f174.google.com [209.85.128.174]) by mx.google.com with ESMTPS id v5si5047564ves.42.2013.12.17.08.28.09 for (version=TLSv1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Tue, 17 Dec 2013 08:28:09 -0800 (PST) Received-SPF: neutral (google.com: 209.85.128.174 is neither permitted nor denied by best guess record for domain of patch+caf_=patchwork-forward=linaro.org@linaro.org) client-ip=209.85.128.174; Received: by mail-ve0-f174.google.com with SMTP id pa12so4395300veb.5 for ; Tue, 17 Dec 2013 08:28:09 -0800 (PST) X-Received: by 10.52.160.130 with SMTP id xk2mr9359643vdb.24.1387297689503; Tue, 17 Dec 2013 08:28:09 -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 u4csp79556vcz; Tue, 17 Dec 2013 08:28:08 -0800 (PST) X-Received: by 10.14.6.136 with SMTP id 8mr23760754een.11.1387297687640; Tue, 17 Dec 2013 08:28:07 -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 j47si4659028eeo.221.2013.12.17.08.28.07 for (version=TLSv1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Tue, 17 Dec 2013 08:28:07 -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 c41so2974405eek.23 for ; Tue, 17 Dec 2013 08:28:07 -0800 (PST) X-Received: by 10.14.108.6 with SMTP id p6mr23640463eeg.31.1387297687107; Tue, 17 Dec 2013 08:28:07 -0800 (PST) Received: from belegaer.uk.xensource.com. ([185.25.64.249]) by mx.google.com with ESMTPSA id e3sm54411471eeg.11.2013.12.17.08.28.02 for (version=TLSv1.2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Tue, 17 Dec 2013 08:28:03 -0800 (PST) From: Julien Grall To: xen-devel@lists.xenproject.org Cc: patches@linaro.org, ian.campbell@citrix.com, ian.jackson@eu.citrix.com, Julien Grall Subject: [PATCH v6 01/10] xen/arm: Introduce steps in domain_relinquish_resource Date: Tue, 17 Dec 2013 16:27:49 +0000 Message-Id: <1387297678-17762-2-git-send-email-julien.grall@linaro.org> X-Mailer: git-send-email 1.7.10.4 In-Reply-To: <1387297678-17762-1-git-send-email-julien.grall@linaro.org> References: <1387297678-17762-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.128.174 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;