From patchwork Mon Dec 9 03:33:58 2013 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Julien Grall X-Patchwork-Id: 22148 Return-Path: X-Original-To: linaro@patches.linaro.org Delivered-To: linaro@patches.linaro.org Received: from mail-ob0-f198.google.com (mail-ob0-f198.google.com [209.85.214.198]) by ip-10-151-82-157.ec2.internal (Postfix) with ESMTPS id 24B8923FE0 for ; Mon, 9 Dec 2013 03:34:17 +0000 (UTC) Received: by mail-ob0-f198.google.com with SMTP id wo20sf12009256obc.1 for ; Sun, 08 Dec 2013 19:34:16 -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=NAQ5POMunSUFsMwfUvNnCRdaly8kdkdTSIcnZI8sbWs=; b=KUYJOaFRR7tadbTrbTjKWn3HrueUv7H2susym0BAafdFJ6b1VYRV0mEas3+tvc3DEU QvSAq1BYHM3gxQip2iwrCu49Meh7A3wY4TgNiuMX7ApcVp4q+Y90HEPWHMc1xo0WJNcn U30UQRp/3ftVuDoRZ+iPkPWEjbkOumoN6VoLxWp/3d4ZsSk4n2Dn9gak4k/aAb/5ufGf qe6mr/nF6TOEVTCH6gu9dAPag+KYL8TLjK1LoV/ze6O8BipheZRR5ypSYKpi9OKLuLNb LG//OKIHlTM9fXu4HDA64f8MQV+dle0EXPpiKalmEKsVL8uBvseOfNhxGh1Yi5XT048z eEMw== X-Gm-Message-State: ALoCoQl8EKluZcClvzQ/Jfs5RoD65FVM/vabymYdg3YX2gKUAG4Q5Efgotsd1KWLWw30a1wVbVey X-Received: by 10.42.131.129 with SMTP id z1mr16816964ics.25.1386560056619; Sun, 08 Dec 2013 19:34:16 -0800 (PST) MIME-Version: 1.0 X-BeenThere: patchwork-forward@linaro.org Received: by 10.49.37.163 with SMTP id z3ls2091102qej.1.gmail; Sun, 08 Dec 2013 19:34:16 -0800 (PST) X-Received: by 10.58.144.168 with SMTP id sn8mr789920veb.33.1386560056512; Sun, 08 Dec 2013 19:34:16 -0800 (PST) Received: from mail-ve0-f180.google.com (mail-ve0-f180.google.com [209.85.128.180]) by mx.google.com with ESMTPS id cp3si3179908vcb.58.2013.12.08.19.34.16 for (version=TLSv1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Sun, 08 Dec 2013 19:34:16 -0800 (PST) Received-SPF: neutral (google.com: 209.85.128.180 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.180; Received: by mail-ve0-f180.google.com with SMTP id jz11so3049360veb.25 for ; Sun, 08 Dec 2013 19:34:16 -0800 (PST) X-Received: by 10.221.40.10 with SMTP id to10mr779537vcb.22.1386560056439; Sun, 08 Dec 2013 19:34:16 -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 u4csp75719vcz; Sun, 8 Dec 2013 19:34:16 -0800 (PST) X-Received: by 10.15.32.73 with SMTP id z49mr11057580eeu.27.1386560055597; Sun, 08 Dec 2013 19:34:15 -0800 (PST) Received: from mail-ea0-f180.google.com (mail-ea0-f180.google.com [209.85.215.180]) by mx.google.com with ESMTPS id u49si7722376eep.85.2013.12.08.19.34.15 for (version=TLSv1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Sun, 08 Dec 2013 19:34:15 -0800 (PST) Received-SPF: neutral (google.com: 209.85.215.180 is neither permitted nor denied by best guess record for domain of julien.grall@linaro.org) client-ip=209.85.215.180; Received: by mail-ea0-f180.google.com with SMTP id f15so1286102eak.39 for ; Sun, 08 Dec 2013 19:34:15 -0800 (PST) X-Received: by 10.14.119.136 with SMTP id n8mr4640536eeh.82.1386560055188; Sun, 08 Dec 2013 19:34:15 -0800 (PST) Received: from belegaer.uk.xensource.com. ([185.25.64.249]) by mx.google.com with ESMTPSA id g7sm23681234eet.12.2013.12.08.19.34.13 for (version=TLSv1.2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Sun, 08 Dec 2013 19:34:14 -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 v2 01/10] xen/arm: Introduce steps in domain_relinquish_resource Date: Mon, 9 Dec 2013 03:33:58 +0000 Message-Id: <1386560047-17500-2-git-send-email-julien.grall@linaro.org> X-Mailer: git-send-email 1.7.10.4 In-Reply-To: <1386560047-17500-1-git-send-email-julien.grall@linaro.org> References: <1386560047-17500-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.180 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;