[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [Xen-devel] [PATCH v7] x86/emulate: Send vm_event from emulate


  • To: Alexandru Stefan ISAILA <aisaila@xxxxxxxxxxxxxxx>
  • From: Jan Beulich <JBeulich@xxxxxxxx>
  • Date: Mon, 29 Jul 2019 11:30:54 +0000
  • Accept-language: en-US
  • Arc-authentication-results: i=1; mx.microsoft.com 1;spf=pass smtp.mailfrom=suse.com;dmarc=pass action=none header.from=suse.com;dkim=pass header.d=suse.com;arc=none
  • Arc-message-signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=1+fvEmq3J36qR6hVysPfkto/BGPJj5KgflRU0n21SA4=; b=YRvoamS7jvdExh/Z2CRR7j/TUaL3K7WVGaSkMe6HQJo0SNmx+e/COGuQdvmjjwLvI/P2AUwKBCsxADDEglqP6CeiZHCDl97e0xMmaJ7UVFqO13shGt7+9fGJrn1lJDgOxsjCsTLwEfKvQ8ew8O6qGJoNGi8pPYKqmYUtCbz0fZZwkXz+Y7jM8jUXB5XvQrakmpb06d40uPxlOk5YFne5eYfXDnGQZKAuiA4JAdRlRUBpvntWtLnzh0SDIDhP1puRfBDenCVVcak5mOLlPpbWkIb/RTr9Q324d2tRFd28d6AnI0b7xKfgzmndEjibNXJ7gsAloqFbbDZOsGEIWIE42w==
  • Arc-seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=PaRsMc4VVracM1ueaSG+XOlzzDWkYANLZFWEY0+I+ZUQrm6M0HTEPcSotnzZD4JjsY7trihXUS34UrW5bN22EPs9/kbY83rRZpjC8xuRw/psvbat1LbEU78fxvGTI2Ya3iP8RQR3a2V2svqTJ6QU6sVDauQikU70IHC/bnUF76u5yfVLzmpEMHOQs9aOWdyghVZXo54uANjd2mp81kvWFk5dEajUC4aUgWlkKP4AAsGNiDQ3chIfbM6TWVs8iSv8wjomxtyZmbyEgDxXY9GF4VOpZ5uxZSaP8WAC8syl2zdMaBcsyRUNwjtvI1gdGDmUe1JwfV23wY0ZgWPCnpFV9g==
  • Authentication-results: spf=none (sender IP is ) smtp.mailfrom=JBeulich@xxxxxxxx;
  • Cc: Petre Ovidiu PIRCALABU <ppircalabu@xxxxxxxxxxxxxxx>, "tamas@xxxxxxxxxxxxx" <tamas@xxxxxxxxxxxxx>, "wl@xxxxxxx" <wl@xxxxxxx>, Razvan Cojocaru <rcojocaru@xxxxxxxxxxxxxxx>, "george.dunlap@xxxxxxxxxxxxx" <george.dunlap@xxxxxxxxxxxxx>, "andrew.cooper3@xxxxxxxxxx" <andrew.cooper3@xxxxxxxxxx>, "paul.durrant@xxxxxxxxxx" <paul.durrant@xxxxxxxxxx>, "xen-devel@xxxxxxxxxxxxxxxxxxxx" <xen-devel@xxxxxxxxxxxxxxxxxxxx>, "roger.pau@xxxxxxxxxx" <roger.pau@xxxxxxxxxx>
  • Delivery-date: Mon, 29 Jul 2019 11:47:13 +0000
  • List-id: Xen developer discussion <xen-devel.lists.xenproject.org>
  • Thread-index: AQHVMY4Gmux1Y/IiSU2ZKtKyOfOCuKbQbceAgAG+GQD//9nvgIAAA2iAgAACSgCAAAxnAIAPT4MAgAA3mQA=
  • Thread-topic: [PATCH v7] x86/emulate: Send vm_event from emulate

On 29.07.2019 10:12, Alexandru Stefan ISAILA wrote:
> 
> 
> On 19.07.2019 17:23, Razvan Cojocaru wrote:
>> On 7/19/19 4:38 PM, Jan Beulich wrote:
>>> On 19.07.2019 15:30, Razvan Cojocaru wrote:
>>>> On 7/19/19 4:18 PM, Jan Beulich wrote:
>>>>> On 19.07.2019 14:34, Alexandru Stefan ISAILA wrote:
>>>>>> On 18.07.2019 15:58, Jan Beulich wrote:
>>>>>>> On 03.07.2019 12:56, Alexandru Stefan ISAILA wrote:
>>>>>>>> A/D bit writes (on page walks) can be considered benign by an
>>>>>>>> introspection
>>>>>>>> agent, so receiving vm_events for them is a pessimization. We try
>>>>>>>> here to
>>>>>>>> optimize by fitering these events out.
>>>>>>>
>>>>>>> But you add the sending of more events - how does "filter out" match
>>>>>>> the actual implementation?
>>>>>>
>>>>>> The events are send only if there is a mem access violation
>>>>>> therefore we
>>>>>> are filtering and only sending the events that are interesting to
>>>>>> introspection.
>>>>>
>>>>> Where is it that you prevent any event from being sent? As said,
>>>>> reading the patch I only see new sending sites to get added.
>>>>
>>>> If we don't emulate, we would receive the page-walk-generated events
>>>> _and_ the touching-the-page-the-instruction-is-touching events.
>>>
>>> Since the patch here alters emulation paths only, how do you know
>>> whether to emulate? In order to not receive undue events it would
>>> seem to me that you'd first have to intercept the guest on insns
>>> of interest ... Overall I think that the patch description, while
>>> it has improved, is still lacking sufficient information for a
>>> person like me (not knowing much about your monitor tools) to be
>>> able to sensibly review this (which includes understanding the
>>> precise scenario you want to improve).
>>
>> If the hardware exits because of an EPT fault caused by a page walk, we
>> end up in p2m_mem_access_check(), at which point we need to decide if we
>> want to send out a vm_event or not.
>>
>> If we were to send out this vm_event, and it would then be magically
>> treated so that we get to actually run the instruction at RIP, said
>> instruction might also hit a protected page and provoke a vm_event.
>>
>> Now, if npfec.kind != npfec_kind_with_gla, then we're in the page walk
>> case, and so in this case only, and only if
>> d->arch.monitor.inguest_pagefault_disabled is true, we would choose to
>> do this emulation trick: emulate _the_page_walk_ while ignoring the EPT,
>> but don't ignore the EPT for the emulation of the actual instruction.
>>
>> So where in the first case we would have 2 EPT events, in the second we
>> only have one (or if the instruction at RIP does not trigger an EPT
>> event, we would have 1 event in the first case, and none in the second).
>> Hence the filtering mentioned.
>>
>> So to answer your question: "how do you know whether to emulate", we do
>> so only if npfec.kind != npfec_kind_with_gla &&
>> d->arch.monitor.inguest_pagefault_disabled.
>>
>> I hope this clears it up somewhat.
>>
> 
> To summarize the changes needed for the next version, apart from the
> code changes, is the description good or do I have to add something else?

As said in a prior reply, Razvan's explanation has helped. I don't think
though that it's suitable as a patch description without some adjustments.
I further seem to recall that I had asked for a concrete example to be
laid out in the description, highlighting what exactly in the overall flow
your patch means to change.

Jan
_______________________________________________
Xen-devel mailing list
Xen-devel@xxxxxxxxxxxxxxxxxxxx
https://lists.xenproject.org/mailman/listinfo/xen-devel

 


Rackspace

Lists.xenproject.org is hosted with RackSpace, monitoring our
servers 24x7x365 and backed by RackSpace's Fanatical Support®.