[Xen-devel] [PATCH RFC v1] x86/emulate: Send vm_event form emulate

2019-01-07 Thread Alexandru Stefan ISAILA
This patch aims to have mem access vm events sent from the emulator. This is useful in the case of page-walks that have to emulate instructions in access denied pages. We use hvmemul_map_linear_addr() ro intercept r/w access and hvmemul_insn_fetch() to intercept exec access. First we try to send

Re: [Xen-devel] [PATCH RFC v1] x86/emulate: Send vm_event form emulate

2019-01-09 Thread Roger Pau Monné
On Mon, Jan 7, 2019 at 2:11 PM Alexandru Stefan ISAILA wrote: > > This patch aims to have mem access vm events sent from the emulator. > This is useful in the case of page-walks that have to emulate > instructions in access denied pages. > > We use hvmemul_map_linear_addr() ro intercept r/w access

Re: [Xen-devel] [PATCH RFC v1] x86/emulate: Send vm_event form emulate

2019-01-09 Thread Jan Beulich
>>> On 09.01.19 at 16:47, wrote: > On Mon, Jan 7, 2019 at 2:11 PM Alexandru Stefan ISAILA > wrote: >> + >> +req.reason = VM_EVENT_REASON_MEM_ACCESS; >> +req.u.mem_access.gfn = gfn_x(gfn); >> +req.u.mem_access.flags |= MEM_ACCESS_FAULT_WITH_GLA | >> MEM_ACCESS_GLA_VALID; >> +req.

Re: [Xen-devel] [PATCH RFC v1] x86/emulate: Send vm_event form emulate

2019-01-10 Thread Alexandru Stefan ISAILA
>> +if ( altp2m_active(current->domain) ) >> +p2m = p2m_get_altp2m(current); >> +if ( !p2m ) >> +p2m = p2m_get_hostp2m(current->domain); >> + >> +gfn_lock(p2m, gfn, 0); >> +mfn = p2m->get_entry(p2m, gfn, &p2mt, &access, 0, NULL, NULL); >> +gfn_unlock(p2m, gfn, 0

Re: [Xen-devel] [PATCH RFC v1] x86/emulate: Send vm_event form emulate

2019-01-10 Thread Roger Pau Monné
On Thu, Jan 10, 2019 at 10:41 AM Alexandru Stefan ISAILA wrote: > > > >> +if ( altp2m_active(current->domain) ) > >> +p2m = p2m_get_altp2m(current); > >> +if ( !p2m ) > >> +p2m = p2m_get_hostp2m(current->domain); > >> + > >> +gfn_lock(p2m, gfn, 0); > >> +mfn = p2m->

Re: [Xen-devel] [PATCH RFC v1] x86/emulate: Send vm_event form emulate

2019-01-10 Thread Alexandru Stefan ISAILA
>>> >>> Newline. >>> +default: +return false; +} >>> >>> I'm not sure the switch is needed, you can't have a PFEC_write_access >>> for example if the p2m type is p2m_access_w or p2m_access_rw, hence it >>> seems like it could be simplified to only take the pfec into

Re: [Xen-devel] [PATCH RFC v1] x86/emulate: Send vm_event form emulate

2019-01-10 Thread Alexandru Stefan ISAILA
>>> >>> Newline. >>> +default: +return false; +} >>> >>> I'm not sure the switch is needed, you can't have a PFEC_write_access >>> for example if the p2m type is p2m_access_w or p2m_access_rw, hence it >>> seems like it could be simplified to only take the pfec into

Re: [Xen-devel] [PATCH RFC v1] x86/emulate: Send vm_event form emulate

2019-01-10 Thread Roger Pau Monné
On Thu, Jan 10, 2019 at 5:40 PM Alexandru Stefan ISAILA wrote: > > > >>> > >>> Newline. > >>> > +default: > +return false; > +} > >>> > >>> I'm not sure the switch is needed, you can't have a PFEC_write_access > >>> for example if the p2m type is p2m_access_w or p2m_