All of lore.kernel.org
 help / color / mirror / Atom feed
From: Ian Campbell <ian.campbell@citrix.com>
To: Tamas K Lengyel <tamas.lengyel@zentific.com>
Cc: Stefano Stabellini <stefano.stabellini@eu.citrix.com>,
	Julien Grall <julien.grall@linaro.org>,
	Ian Jackson <ian.jackson@eu.citrix.com>,
	"xen-devel@lists.xen.org" <xen-devel@lists.xen.org>,
	Stefano Stabellini <stefano.stabellini@citrix.com>,
	Tamas K Lengyel <tklengyel@sec.in.tum.de>
Subject: Re: [PATCH V13 5/7] xen/arm: Instruction prefetch abort (X) mem_event handling
Date: Thu, 26 Mar 2015 11:53:52 +0000	[thread overview]
Message-ID: <1427370832.13935.37.camel@citrix.com> (raw)
In-Reply-To: <CAErYnsjMPaBEGCgiyBbrMANM_0cNTEbzObW4=71n1mbZwoH3yA@mail.gmail.com>

On Thu, 2015-03-26 at 12:24 +0100, Tamas K Lengyel wrote:

> >>  I looked at the KVM code and they seem to query HPFAR_EL2 if the
> >> fault is during s1ptw, but otherwise they do exactly what we do here.
> >
> > Yes, reading their comment there lead me to the bit of the ARM ARM and I
> > think there may be improvements we could make to the non-xenaccess case
> > at least, I was confused about HPFAR_EL2 va FAR_EL2 earlier.
> 
> IMHO it's very minor performance tuning and for data access violations
> the cache probably already has the same translation so I wouldn't be
> surprised if the two would cost the same amount of cycles. For
> prefetch it's useful because we don't have to rely on the cache being
> valid.

I'm thinking along the lines of:
        if (HPFAR_EL2 is valid)
                ipa = read HPFAR_EL2
        else
                ipa = gva_to_ipa of FAR_EL2 (via info.gva)

Then handle ipa as usual, including potentially an ipa->pa/pte lookup
when needed, which is safe because we guarantee that we don't play TLB
tricks to try and game ourselves.

The bit I've not yet convinced myself of is whether "HPFAR_EL2 is valid"
is true for all the potentially problematic cases. TFM says (G4.13.5):

        For any Access flag fault or Translation fault, and also for any
        Permission fault on the stage 2 translation of a memory access
        made as part of a translation table walk for a stage 1
        translation, the
        HPFAR holds the IPA that caused the fault. Otherwise, the HPFAR
        is UNKNOWN .

So that excludes Address Size and Access flag, but I think we don't care
about those, or at least not in a way which would require us to do a
lookup.

Table G4-33 also looks very informative too BTW.

Anyway, that all sounds pretty promising, we'd need to do a bit more
deciding of the FSC than we do today but that's not too hard.

>  Furthermore, I yet to see a single event being delivered that
> happened during s1ptw. For some reason my domain's normal operations
> don't seem to trigger any, even if I create new processes etc..

You would need to make a stage 1 page table entry be non-present or at
least not readable to hit that, I suppose you have tried doing so via
xenaccess e.g. setting all of guest to some suitable type? Very strange
not to then see a s1ptw fault.

The other way would be xenpaging, which we don't do on ARM.

Ian.

  reply	other threads:[~2015-03-26 11:53 UTC|newest]

Thread overview: 71+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-03-06 21:24 [PATCH V13 0/7] Mem_access for ARM Tamas K Lengyel
2015-03-06 21:24 ` [PATCH V13 1/7] xen/arm: p2m changes for mem_access support Tamas K Lengyel
2015-03-11 16:07   ` Stefano Stabellini
2015-03-11 17:05     ` Tamas K Lengyel
2015-03-12 11:27   ` Ian Campbell
2015-03-12 12:22     ` Tamas K Lengyel
2015-03-12 13:53       ` Ian Campbell
2015-03-12 12:57   ` Julien Grall
2015-03-12 13:18     ` Tamas K Lengyel
2015-03-12 13:25       ` Julien Grall
2015-03-12 13:55         ` Ian Campbell
2015-03-12 13:56     ` Ian Campbell
2015-03-12 14:10       ` Andrew Cooper
2015-03-12 16:56         ` Julien Grall
2015-03-12 17:11           ` Ian Campbell
2015-03-06 21:24 ` [PATCH V13 2/7] xen/arm: Implement domain_get_maximum_gpfn Tamas K Lengyel
2015-03-11 15:43   ` Stefano Stabellini
2015-03-06 21:24 ` [PATCH V13 3/7] xen/arm: Allow hypervisor access to mem_access protected pages Tamas K Lengyel
2015-03-12 12:08   ` Ian Campbell
2015-03-12 12:31     ` Tamas K Lengyel
2015-03-12 13:24   ` Julien Grall
2015-03-12 13:38     ` Tamas K Lengyel
2015-03-12 13:43       ` Julien Grall
2015-03-12 14:33         ` Tamas K Lengyel
2015-03-12 13:50   ` Julien Grall
2015-03-12 14:13     ` Tamas K Lengyel
2015-03-12 14:52       ` Julien Grall
2015-03-12 15:27         ` Ian Campbell
2015-03-12 15:40           ` Julien Grall
2015-03-12 15:44             ` Tamas K Lengyel
2015-03-12 15:56               ` Ian Campbell
2015-03-12 16:02                 ` Tamas K Lengyel
2015-03-12 16:48                   ` Ian Campbell
2015-03-12 16:55                     ` Tamas K Lengyel
2015-03-12 15:54             ` Ian Campbell
2015-03-12 15:41           ` Tamas K Lengyel
2015-03-12 15:55             ` Ian Campbell
2015-03-12 16:10               ` Tamas K Lengyel
2015-03-06 21:24 ` [PATCH V13 4/7] xen/arm: Data abort exception (R/W) mem_events Tamas K Lengyel
2015-03-12 13:35   ` Ian Campbell
2015-03-12 15:13     ` Tamas K Lengyel
2015-03-12 15:19       ` Tamas K Lengyel
2015-03-12 15:24         ` Julien Grall
2015-03-12 15:35         ` Ian Campbell
2015-03-12 16:35           ` Julien Grall
2015-03-12 15:30       ` Ian Campbell
2015-03-12 15:13   ` Julien Grall
2015-03-12 15:26     ` Tamas K Lengyel
2015-03-12 15:37       ` Julien Grall
2015-03-12 15:46         ` Ian Campbell
2015-03-12 16:54           ` Julien Grall
2015-03-06 21:24 ` [PATCH V13 5/7] xen/arm: Instruction prefetch abort (X) mem_event handling Tamas K Lengyel
2015-03-23 14:32   ` Tamas K Lengyel
2015-03-23 15:15     ` Ian Campbell
2015-03-23 15:18       ` Ian Campbell
2015-03-23 15:47         ` Tamas K Lengyel
2015-03-23 16:22           ` Ian Campbell
2015-03-23 16:47             ` Tamas K Lengyel
2015-03-24 13:06               ` Tamas K Lengyel
2015-03-26 10:50                 ` Ian Campbell
2015-03-26 11:24                   ` Tamas K Lengyel
2015-03-26 11:53                     ` Ian Campbell [this message]
2015-03-06 21:24 ` [PATCH V13 6/7] xen/arm: Enable mem_access on ARM Tamas K Lengyel
2015-03-12 13:36   ` Ian Campbell
2015-03-12 15:19   ` Julien Grall
2015-03-12 15:43     ` Tamas K Lengyel
2015-03-06 21:24 ` [PATCH V13 7/7] tools/libxc: Allocate magic page for mem access " Tamas K Lengyel
2015-03-12 13:36   ` Ian Campbell
2015-03-12 11:30 ` [PATCH V13 0/7] Mem_access for ARM Ian Campbell
2015-03-12 12:24   ` Tamas K Lengyel
2015-03-12 13:53     ` Ian Campbell

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=1427370832.13935.37.camel@citrix.com \
    --to=ian.campbell@citrix.com \
    --cc=ian.jackson@eu.citrix.com \
    --cc=julien.grall@linaro.org \
    --cc=stefano.stabellini@citrix.com \
    --cc=stefano.stabellini@eu.citrix.com \
    --cc=tamas.lengyel@zentific.com \
    --cc=tklengyel@sec.in.tum.de \
    --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.