aboutsummaryrefslogtreecommitdiffstats
path: root/xen
diff options
context:
space:
mode:
authorOlaf Hering <olaf@aepfle.de>2012-01-30 13:06:34 +0100
committerOlaf Hering <olaf@aepfle.de>2012-01-30 13:06:34 +0100
commite47ceecc301c3d1123aaf2c6d95f214a6dda4e81 (patch)
tree094784068704a10041f7d176ba655d4191b1721f /xen
parentd3ec7b04d08dabb37bb09eb6876700f4f81f9392 (diff)
downloadxen-e47ceecc301c3d1123aaf2c6d95f214a6dda4e81.tar.gz
xen-e47ceecc301c3d1123aaf2c6d95f214a6dda4e81.tar.bz2
xen-e47ceecc301c3d1123aaf2c6d95f214a6dda4e81.zip
xenpaging: unify return value in nominate and evict
Let p2m_mem_paging_nominate and p2m_mem_paging_evict return just one error number. EINVAL is not very helpful in case of nominate, it can happen if the pager tries to nominate a ballooned page. In this case the gfn is not backed by a mfn, the pager can not know that. Similar with evict, anything can happen between nominate and evict. This change helps the pager to decide if the returned error is from the function itself, or if it happend earlier. In the latter case, it is most likely fatal and should be handled as such. nominate and evict return EBUSY, which is supposed to mean "pager request reached target function, and failed." Signed-off-by: Olaf Hering <olaf@aepfle.de> Acked-by: Tim Deegan <tim@xen.org> Committed-by: Tim Deegan <tim@xen.org>
Diffstat (limited to 'xen')
-rw-r--r--xen/arch/x86/mm/p2m.c7
1 files changed, 2 insertions, 5 deletions
diff --git a/xen/arch/x86/mm/p2m.c b/xen/arch/x86/mm/p2m.c
index 844766a5e5..a7441e16ea 100644
--- a/xen/arch/x86/mm/p2m.c
+++ b/xen/arch/x86/mm/p2m.c
@@ -735,19 +735,17 @@ int p2m_mem_paging_nominate(struct domain *d, unsigned long gfn)
p2m_type_t p2mt;
p2m_access_t a;
mfn_t mfn;
- int ret;
+ int ret = -EBUSY;
p2m_lock(p2m);
mfn = p2m->get_entry(p2m, gfn, &p2mt, &a, p2m_query, NULL);
/* Check if mfn is valid */
- ret = -EINVAL;
if ( !mfn_valid(mfn) )
goto out;
/* Check p2m type */
- ret = -EAGAIN;
if ( !p2m_is_pageable(p2mt) )
goto out;
@@ -799,7 +797,7 @@ int p2m_mem_paging_evict(struct domain *d, unsigned long gfn)
p2m_access_t a;
mfn_t mfn;
struct p2m_domain *p2m = p2m_get_hostp2m(d);
- int ret = -EINVAL;
+ int ret = -EBUSY;
p2m_lock(p2m);
@@ -812,7 +810,6 @@ int p2m_mem_paging_evict(struct domain *d, unsigned long gfn)
if ( p2mt != p2m_ram_paging_out )
goto out;
- ret = -EBUSY;
/* Get the page so it doesn't get modified under Xen's feet */
page = mfn_to_page(mfn);
if ( unlikely(!get_page(page, d)) )