From mboxrd@z Thu Jan 1 00:00:00 1970 From: Andrew Cooper Subject: Re: memaccess: skipping mem_access_send_req Date: Fri, 10 Apr 2015 17:03:26 +0100 Message-ID: <5527F44E.6090302@citrix.com> References: Mime-Version: 1.0 Content-Type: multipart/mixed; boundary="===============5410027389997848400==" Return-path: In-Reply-To: List-Unsubscribe: , List-Post: List-Help: List-Subscribe: , Sender: xen-devel-bounces@lists.xen.org Errors-To: xen-devel-bounces@lists.xen.org To: xen-devel@lists.xen.org List-Id: xen-devel@lists.xenproject.org --===============5410027389997848400== Content-Type: multipart/alternative; boundary="------------050503020502020004040002" --------------050503020502020004040002 Content-Type: text/plain; charset="windows-1252" Content-Transfer-Encoding: 7bit On 10/04/15 16:04, Gareth Stockwell wrote: > > My understanding of memaccess is that it provides the following > functionality: > > > > 1. Modify permission values in the page table of the target domain. > > 2. When the domain generates an illegal access, the exception handler > delegates to memaccess, which pauses the VCPU and records the event in > a ring buffer. > > 3. Some permission values are special in that they automatically > mutate to a different value following the first access; others are > persistently applied. > > > > We would like to use memaccess to perform (1) - but rather than > pausing the VCPU in (2), instead simply directly inject the exception > into the VCPU. I can see two ways of doing this: > > > > a) Implement an observer of the ring buffer, which triggers injection > of the exception and unpausing of the VCPU. > > b) Define new xenmem_access_t values which cause the exception handler > to reinject rather than adding a message to the ring buffer. > > > > (a) seems cumbersome, and requires multiple context switches in order > to handle the exception. > > (b) therefore looks preferable, and I think should be fairly simple to > implement on top of https://github.com/tklengyel/xen/tree/arm_memaccess15. > > > > Does this sound reasonable? Or is there a better way of modifying > access permissions for a specific pfn range of a target domain? > Are you perhaps looking for something similar to Intel #VE support? (although I guess you are looking at ARM rather than x86) It is not safe to always re-inject back into the vcpu, especially if the permission changes were around the guest kernel stack, but a restricted subset ought to be safe to bounce straight in. ~Andrew --------------050503020502020004040002 Content-Type: text/html; charset="windows-1252" Content-Length: 4646 Content-Transfer-Encoding: quoted-printable
On 10/04/15 16:04, Gareth Stockwell wrote:

My understanding of memaccess is that it provides the following functionality:

=A0

1. Modify permission values in the page table of the target domain.

2. When the domain generates an illegal access, the exception handler delegates to memaccess, which pauses the VCPU and records the event in a ring buffer.

3. Some permission values are special in that they automatically mutate to a different value following the first access; others are persistently applied.

=A0

We would like to use memaccess to perform (1) - but rather than pausing the VCPU in (2), instead simply directly inject the exception into the VCPU.=A0 I can see two ways of doing this:

=A0

a) Implement an observer of the ring buffer, which triggers injection of the exception and unpausing of the VCPU.

b) Define new xenmem_access_t values which cause the exception handler to reinject rather than adding a message to the ring buffer.

=A0

(a) seems cumbersome, and requires multiple context switches in order to handle the exception.

(b) therefore looks preferable, and I think should be fairly simple to implement on top of https://github.com/tklengyel/xen/tree/arm_memaccess15.

=A0

Does this sound reasonable=3F=A0 Or is there a better way of modifying access permissions for a specific pfn range of a target domain=3F


Are you perhaps looking for something similar to Intel #VE support=3F=A0 (although I guess you are looking at ARM rather than x86)

It is not safe to always re-inject back into the vcpu, especially if the permission changes were around the guest kernel stack, but a restricted subset ought to be safe to bounce straight in.

~Andrew
--------------050503020502020004040002-- --===============5410027389997848400== Content-Type: text/plain; charset="us-ascii" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Content-Disposition: inline _______________________________________________ Xen-devel mailing list Xen-devel@lists.xen.org http://lists.xen.org/xen-devel --===============5410027389997848400==--