From: Wei Liu <wei.liu2@citrix.com>
To: Jan Beulich <JBeulich@suse.com>
Cc: Andrew Cooper <andrew.cooper3@citrix.com>,
Wei Liu <wei.liu2@citrix.com>,
Xen-devel <xen-devel@lists.xenproject.org>
Subject: Re: [PATCH v2 2/2] x86/mm: merge ptwr and mmio_ro page fault handlers
Date: Fri, 1 Sep 2017 14:46:27 +0100 [thread overview]
Message-ID: <20170901134627.gxbfjezyn73shlws@citrix.com> (raw)
In-Reply-To: <59A946C902000078001766EC@prv-mh.provo.novell.com>
On Fri, Sep 01, 2017 at 03:38:49AM -0600, Jan Beulich wrote:
> > /*************************
> > * fault handling for read-only MMIO pages
> > */
>
> Note how you move the remains of the function above below this
> comment, which isn't really correct.
I can place the new function where the old was.
>
[..]
> > +int pv_ro_page_fault(struct vcpu *v, unsigned long addr,
>
> Since you alter this and the caller anyway, the first parameter
> could as well become const struct domain *, simplifying ...
>
> > + struct cpu_user_regs *regs)
> > +{
> > + l1_pgentry_t pte;
> > + struct domain *d = v->domain;
> > + unsigned int addr_size = is_pv_32bit_vcpu(v) ? 32 : BITS_PER_LONG;
> > + struct x86_emulate_ctxt ctxt = {
> > + .regs = regs,
> > + .vendor = d->arch.cpuid->x86_vendor,
> > + .addr_size = addr_size,
> > + .sp_size = addr_size,
> > + .lma = !is_pv_32bit_vcpu(v),
>
> ... both is_pv_32bit_vcpu() accesses here (which internally use
> v->domain). In fact I wonder whether it wouldn't yield more
> consistent code if you didn't pass in the domain at all, as this
> must strictly be current->domain, or invoking x86_emulate() and
> various other functions is bogus. You'd then latch this into currd
> here.
>
> Furthermore I think this second use could become "addr_size > 32".
>
Sorry, second use of what?
_______________________________________________
Xen-devel mailing list
Xen-devel@lists.xen.org
https://lists.xen.org/xen-devel
next prev parent reply other threads:[~2017-09-01 13:46 UTC|newest]
Thread overview: 9+ messages / expand[flat|nested] mbox.gz Atom feed top
2017-08-31 11:22 [PATCH v2 0/2] x86/mm: merge ptwr and mmio_ro page fault handlers Wei Liu
2017-08-31 11:22 ` [PATCH v2 1/2] x86/mm: don't wrap x86_emulate_ctxt in ptwr_emulate_ctxt Wei Liu
2017-08-31 12:37 ` Andrew Cooper
2017-09-01 9:16 ` Jan Beulich
2017-08-31 11:22 ` [PATCH v2 2/2] x86/mm: merge ptwr and mmio_ro page fault handlers Wei Liu
2017-09-01 9:38 ` Jan Beulich
2017-09-01 13:46 ` Wei Liu [this message]
2017-09-01 13:50 ` Wei Liu
2017-09-01 15:29 ` Jan Beulich
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=20170901134627.gxbfjezyn73shlws@citrix.com \
--to=wei.liu2@citrix.com \
--cc=JBeulich@suse.com \
--cc=andrew.cooper3@citrix.com \
--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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).