From: Razvan Cojocaru <rcojocaru@bitdefender.com>
To: Jan Beulich <JBeulich@suse.com>
Cc: kevin.tian@intel.com, Ian.Campbell@citrix.com,
stefano.stabellini@eu.citrix.com, andrew.cooper3@citrix.com,
eddie.dong@intel.com, xen-devel@lists.xen.org,
andres@lagarcavilla.org, jun.nakajima@intel.com,
Ian.Jackson@eu.citrix.com
Subject: Re: [PATCH RFC V3 4/5] xen, libxc: Request page fault injection via libxc
Date: Thu, 24 Jul 2014 19:18:46 +0300 [thread overview]
Message-ID: <53D131E6.6010606@bitdefender.com> (raw)
In-Reply-To: <53D1421F0200007800025A53@mail.emea.novell.com>
On 07/24/2014 06:27 PM, Jan Beulich wrote:
>>>> On 23.07.14 at 14:34, <rcojocaru@bitdefender.com> wrote:
>> +static void check_pf_injection(void)
>> +{
>> + struct vcpu *curr = current;
>> + struct domain *d = curr->domain;
>> + struct hvm_hw_cpu ctxt;
>> + struct segment_register seg;
>> + int errcode = PFEC_user_mode;
>> +
>> + if ( !is_hvm_domain(d)
>> + || d->arch.hvm_domain.fault_info.virtual_address == 0 )
>> + return;
>> +
>> + hvm_funcs.save_cpu_ctxt(curr, &ctxt);
>
> Isn't this a little heavy handed?
It did seem that way to me too, but I couldn't find another way to get
to ctxt.pending_event and CR3 at this point in the code. Is there an
alternative I'm not aware of?
>> + hvm_get_segment_register(curr, x86_seg_ss, &seg);
>> +
>> + if ( seg.attr.fields.dpl == 3 /* Guest is in user mode */
>
> Did you verify that this covers VM86 mode too?
Assuming CPL is SS.DPL (I've been previously been using CS.DPL), it did
work in our tests, yes.
>> + && !ctxt.pending_event
>> + && ctxt.cr3 == d->arch.hvm_domain.fault_info.address_space )
>> + {
>> + /* Cache */
>
> Cache? Did you mean "Latch" or some such perhaps?
>
>> + uint64_t virtual_address = d->arch.hvm_domain.fault_info.virtual_address;
>> + uint32_t write_access = d->arch.hvm_domain.fault_info.write_access;
I meant "cache", as in "I'm caching
d->arch.hvm_domain.fault_info.virtual_address into virtual_address"
before resetting it, but the comment is not only unimportant but
obviously confusing, so I'll take it out.
>> + /* Reset */
>> + d->arch.hvm_domain.fault_info.address_space = 0;
>> + d->arch.hvm_domain.fault_info.virtual_address = 0;
>> + d->arch.hvm_domain.fault_info.write_access = 0;
>> +
>> + if ( write_access )
>> + errcode |= PFEC_write_access;
>> +
>> + hvm_inject_page_fault(errcode, virtual_address);
>> + }
>> +}
>
> Even together with its call site it's remaining unclear without knowing
> almost all of the rest of your code why this function would inject
> only two types of page faults (and I'm still not finally sure this is
> intended/correct). A comment would certainly help, short of a
> more descriptive name for the function (which I suppose would get
> unreasonably long).
The function, as previously suggested, will be split into the check part
and the injection part.
What our code does in this case has been briefly described here:
http://lists.xen.org/archives/html/xen-devel/2014-07/msg03013.html
>> @@ -1012,6 +1024,7 @@ struct xen_domctl {
>> #define XEN_DOMCTL_gdbsx_pausevcpu 1001
>> #define XEN_DOMCTL_gdbsx_unpausevcpu 1002
>> #define XEN_DOMCTL_gdbsx_domstatus 1003
>> +#define XEN_DOMCTL_set_pagefault_info 1004
>
> That doesn't look like the range you want to extend.
Could you please elaborate? Thank you.
Thanks,
Razvan Cojocaru
next prev parent reply other threads:[~2014-07-24 16:18 UTC|newest]
Thread overview: 31+ messages / expand[flat|nested] mbox.gz Atom feed top
2014-07-23 12:34 [PATCH RFC V3 1/5] xen: Emulate with no writes Razvan Cojocaru
2014-07-23 12:34 ` [PATCH RFC V3 2/5] xen: Optimize introspection access to guest state Razvan Cojocaru
2014-07-24 15:07 ` Jan Beulich
2014-07-23 12:34 ` [PATCH RFC V3 3/5] xen: Force-enable relevant MSR events; optimize the number of sent MSR events Razvan Cojocaru
2014-07-24 15:14 ` Jan Beulich
2014-07-24 15:56 ` Razvan Cojocaru
2014-07-23 12:34 ` [PATCH RFC V3 4/5] xen, libxc: Request page fault injection via libxc Razvan Cojocaru
2014-07-23 13:40 ` Tamas Lengyel
2014-07-23 14:08 ` Razvan Cojocaru
2014-07-23 14:27 ` Tamas Lengyel
2014-07-23 15:13 ` Razvan Cojocaru
2014-07-23 20:17 ` Andrei LUTAS
2014-07-24 12:38 ` Ian Jackson
2014-07-24 12:41 ` Andrew Cooper
2014-07-24 12:44 ` Razvan Cojocaru
2014-07-24 12:33 ` Ian Jackson
2014-07-24 15:27 ` Jan Beulich
2014-07-24 16:18 ` Razvan Cojocaru [this message]
2014-07-25 7:50 ` Jan Beulich
2014-07-23 12:34 ` [PATCH RFC V3 5/5] xen: Handle resumed instruction based on previous mem_event reply Razvan Cojocaru
2014-07-24 15:42 ` Jan Beulich
2014-07-24 16:29 ` Razvan Cojocaru
2014-07-25 7:52 ` Jan Beulich
2014-07-24 11:20 ` [PATCH RFC V3 1/5] xen: Emulate with no writes Tim Deegan
2014-07-24 11:40 ` Razvan Cojocaru
2014-07-25 13:52 ` Razvan Cojocaru
2014-07-25 14:07 ` Jan Beulich
2014-07-24 12:32 ` Ian Jackson
2014-07-24 12:36 ` Razvan Cojocaru
2014-07-24 12:37 ` Razvan Cojocaru
2014-07-24 17:25 ` Tian, Kevin
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=53D131E6.6010606@bitdefender.com \
--to=rcojocaru@bitdefender.com \
--cc=Ian.Campbell@citrix.com \
--cc=Ian.Jackson@eu.citrix.com \
--cc=JBeulich@suse.com \
--cc=andres@lagarcavilla.org \
--cc=andrew.cooper3@citrix.com \
--cc=eddie.dong@intel.com \
--cc=jun.nakajima@intel.com \
--cc=kevin.tian@intel.com \
--cc=stefano.stabellini@eu.citrix.com \
--cc=xen-devel@lists.xen.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.