From: "Jan Beulich" <JBeulich@suse.com>
To: xen-devel <xen-devel@lists.xenproject.org>
Cc: Tim Deegan <tim@xen.org>, Keir Fraser <keir@xen.org>
Subject: [PATCH] x86/HVM: clean up HVMOP_set_mem_type processing
Date: Wed, 30 Apr 2014 14:47:54 +0100 [thread overview]
Message-ID: <53611B2A020000780000DC9E@mail.emea.novell.com> (raw)
[-- Attachment #1: Type: text/plain, Size: 2554 bytes --]
- drop unused variable "mfn"
- consistently do not use "else" when the prior "if" ends in "goto"
- use printk() referencing the target domain instead of gdprintk()
(which references the current domain) and slightly shorten message
- annotate -EINVAL results in paging/shared paths to actually need
switching to -EAGAIN (possible only when preemption logic got fixed
to use -ERESTART)
Signed-off-by: Jan Beulich <jbeulich@suse.com>
--- a/xen/arch/x86/hvm/hvm.c
+++ b/xen/arch/x86/hvm/hvm.c
@@ -4522,21 +4522,20 @@ long do_hvm_op(unsigned long op, XEN_GUE
while ( a.nr > start_iter )
{
unsigned long pfn = a.first_pfn + start_iter;
- p2m_type_t t;
- p2m_type_t nt;
- mfn_t mfn;
- mfn = get_gfn_unshare(d, pfn, &t);
+ p2m_type_t t, nt;
+
+ get_gfn_unshare(d, pfn, &t);
if ( p2m_is_paging(t) )
{
put_gfn(d, pfn);
p2m_mem_paging_populate(d, pfn);
- rc = -EINVAL;
+ rc = -EINVAL; /* XXX EAGAIN */
goto param_fail4;
}
if ( p2m_is_shared(t) )
{
put_gfn(d, pfn);
- rc = -EINVAL;
+ rc = -EINVAL; /* XXX EAGAIN */
goto param_fail4;
}
if ( !p2m_is_ram(t) &&
@@ -4545,18 +4544,14 @@ long do_hvm_op(unsigned long op, XEN_GUE
put_gfn(d, pfn);
goto param_fail4;
}
- else
+ nt = p2m_change_type(d, pfn, t, memtype[a.hvmmem_type]);
+ if ( nt != t )
{
- nt = p2m_change_type(d, pfn, t, memtype[a.hvmmem_type]);
- if ( nt != t )
- {
- put_gfn(d, pfn);
- gdprintk(XENLOG_WARNING,
- "type of pfn %#lx changed from %d to %d while "
- "we were trying to change it to %d\n",
- pfn, t, nt, memtype[a.hvmmem_type]);
- goto param_fail4;
- }
+ put_gfn(d, pfn);
+ printk(XENLOG_G_WARNING
+ "d%d: GFN %#lx type changed from %d to %d while trying to change it to %d\n",
+ d->domain_id, pfn, t, nt, memtype[a.hvmmem_type]);
+ goto param_fail4;
}
put_gfn(d, pfn);
[-- Attachment #2: x86-HVM-cleanup-set-mem-type.patch --]
[-- Type: text/plain, Size: 2599 bytes --]
x86/HVM: clean up HVMOP_set_mem_type processing
- drop unused variable "mfn"
- consistently do not use "else" when the prior "if" ends in "goto"
- use printk() referencing the target domain instead of gdprintk()
(which references the current domain) and slightly shorten message
- annotate -EINVAL results in paging/shared paths to actually need
switching to -EAGAIN (possible only when preemption logic got fixed
to use -ERESTART)
Signed-off-by: Jan Beulich <jbeulich@suse.com>
--- a/xen/arch/x86/hvm/hvm.c
+++ b/xen/arch/x86/hvm/hvm.c
@@ -4522,21 +4522,20 @@ long do_hvm_op(unsigned long op, XEN_GUE
while ( a.nr > start_iter )
{
unsigned long pfn = a.first_pfn + start_iter;
- p2m_type_t t;
- p2m_type_t nt;
- mfn_t mfn;
- mfn = get_gfn_unshare(d, pfn, &t);
+ p2m_type_t t, nt;
+
+ get_gfn_unshare(d, pfn, &t);
if ( p2m_is_paging(t) )
{
put_gfn(d, pfn);
p2m_mem_paging_populate(d, pfn);
- rc = -EINVAL;
+ rc = -EINVAL; /* XXX EAGAIN */
goto param_fail4;
}
if ( p2m_is_shared(t) )
{
put_gfn(d, pfn);
- rc = -EINVAL;
+ rc = -EINVAL; /* XXX EAGAIN */
goto param_fail4;
}
if ( !p2m_is_ram(t) &&
@@ -4545,18 +4544,14 @@ long do_hvm_op(unsigned long op, XEN_GUE
put_gfn(d, pfn);
goto param_fail4;
}
- else
+ nt = p2m_change_type(d, pfn, t, memtype[a.hvmmem_type]);
+ if ( nt != t )
{
- nt = p2m_change_type(d, pfn, t, memtype[a.hvmmem_type]);
- if ( nt != t )
- {
- put_gfn(d, pfn);
- gdprintk(XENLOG_WARNING,
- "type of pfn %#lx changed from %d to %d while "
- "we were trying to change it to %d\n",
- pfn, t, nt, memtype[a.hvmmem_type]);
- goto param_fail4;
- }
+ put_gfn(d, pfn);
+ printk(XENLOG_G_WARNING
+ "d%d: GFN %#lx type changed from %d to %d while trying to change it to %d\n",
+ d->domain_id, pfn, t, nt, memtype[a.hvmmem_type]);
+ goto param_fail4;
}
put_gfn(d, pfn);
[-- Attachment #3: Type: text/plain, Size: 126 bytes --]
_______________________________________________
Xen-devel mailing list
Xen-devel@lists.xen.org
http://lists.xen.org/xen-devel
next reply other threads:[~2014-04-30 13:47 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2014-04-30 13:47 Jan Beulich [this message]
2014-04-30 14:13 ` [PATCH] x86/HVM: clean up HVMOP_set_mem_type processing Andrew Cooper
2014-05-01 14:50 ` Tim Deegan
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=53611B2A020000780000DC9E@mail.emea.novell.com \
--to=jbeulich@suse.com \
--cc=keir@xen.org \
--cc=tim@xen.org \
--cc=xen-devel@lists.xenproject.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.