From: christoffer.dall@linaro.org (Christoffer Dall)
To: linux-arm-kernel@lists.infradead.org
Subject: [PATCH v9 14/14] virt: arm: support hip04 gic
Date: Wed, 21 May 2014 10:55:41 +0100 [thread overview]
Message-ID: <20140521095541.GC39503@lvm> (raw)
In-Reply-To: <CAD6h2NQHqisW0_nYQ9XyHXrX57Z7mcxeVwyFMiSyCm7Tt8n8KA@mail.gmail.com>
On Wed, May 21, 2014 at 05:47:00PM +0800, Haojian Zhuang wrote:
> On 21 May 2014 17:02, Christoffer Dall <christoffer.dall@linaro.org> wrote:
> > On Tue, May 20, 2014 at 11:39:12PM +0800, Haojian Zhuang wrote:
> >> On 20 May 2014 23:05, Christoffer Dall <christoffer.dall@linaro.org> wrote:
> >> > On Tue, May 20, 2014 at 10:16:22PM +0800, Haojian Zhuang wrote:
> >> >> On 20 May 2014 22:01, Christoffer Dall <christoffer.dall@linaro.org> wrote:
> >> >> It's the implementation of gich_apr in arm32.
> >> >>
> >> >> We needn't add or change anything in struct vgic_cpu. And both the
> >> >> assembly code and the code could be much easier.
> >> >>
> >> >
> >> > But we do end up with an extra memory access from EL2 in the critical
> >> > path, and I believe Marc's concern here is that if we cross a cache
> >> > line, this might really hurt performance.
> >> >
> >>
> >> Sorry. Do we may cross a cache line or a TLB entry?
> >>
> >> I think that you're concerning to cross TLB entries. The reason is in
> >> below.
> >>
> >> 1. If the problem is on crossing cache line, it's caused by too much
> >> instructions. Either the packing nr_lr or the gich_apr adds some
> >> instructions. The packing nr_lr needs a little more instructions.
> >
> > I don't see why this argument is valid. If you have a separate
>
> I want to make it clear what I missing.
>
> > instruction and data cache, you may be loading from a different cache
> > line when placing the static value close to your instructions. If you
> > add a variable to the vcpu struct, all of the fields may no longer fit
> > in a single data cache line and you may cause the memory subsystem to
> > have to fetch another cache line. I believe the latter is Marc's
>
> Yes, I forgot new gich_apr is the only variable in the assembly code.
> So the gich_apr will be load from a different cache line.
>
> Then let's come back to packing hw_cfg.
>
> Now the high word is used to store the offset of GICH_APR. The
> unpacking operation is too complex to calculate the register offset,
> especially in arm64 implementation.
>
> How about changing the packing mechanism?
>
> 1. Add the definition of enconding in arm-gic.h.
>
> #define HIP04_GIC (1 << 16)
> #define HIP04_GICH_APR 0x70
> #define HIP04_GICH_LR0 0x80
>
> 2. The code in save_vgic_state could be changed in below.
>
> ldr r9, [r2, #GICH_ELRSR1]
> +ldr r10, [r3, #VGIC_CPU_HW_CFG]
> +tst r10, #HIP04_GIC
> +ldreq r10, [r2, #GICH_APR]
> +ldrne r10, [r2, #HIP04_GICH_APR]
>
> Although I used the condition checking at here, the code could
> be easier.
>
> I think that the executing time on "ldr" and "ldreq" should be same,
> because CPCS should be ready
>
> Then calculation is avoid. Only three instructions are appended
> for both GICH_APR & GICH_LR0. The implementation in arm64
> should be same & simple.
>
I think you misunderstood my point.
Keep the assembly code as is, store the APR and the NR_LR in the HW_CFG
always, on all systems, and don't use any conditionals in the assembly
code (code is difficult to read, instruction prefetching and speculative
execution becomes difficult, etc.).
Only change something in the C-code. Set a static variable there during
vgic_hyp_init and get rid of all the local variable declarations that
dereference the vgic_vcpu struct.
-Christoffer
next prev parent reply other threads:[~2014-05-21 9:55 UTC|newest]
Thread overview: 36+ messages / expand[flat|nested] mbox.gz Atom feed top
2014-05-20 13:10 [PATCH v9 00/14] enable HiP04 SoC Haojian Zhuang
2014-05-20 13:10 ` [PATCH v9 01/14] ARM: debug: add HiP04 debug uart Haojian Zhuang
2014-05-20 13:10 ` [PATCH v9 02/14] irq: gic: support hip04 gic Haojian Zhuang
2014-05-21 10:15 ` Marc Zyngier
2014-06-21 1:54 ` Jason Cooper
2014-07-08 22:40 ` Jason Cooper
2014-07-10 1:24 ` Haojian Zhuang
2014-05-20 13:10 ` [PATCH v9 03/14] ARM: mcpm: support 4 clusters Haojian Zhuang
2014-05-20 13:10 ` [PATCH v9 04/14] ARM: hisi: add ARCH_HISI Haojian Zhuang
2014-05-20 13:10 ` [PATCH v9 05/14] ARM: hisi: enable MCPM implementation Haojian Zhuang
2014-05-21 1:29 ` Nicolas Pitre
2014-05-21 1:48 ` Haojian Zhuang
2014-05-21 2:06 ` Nicolas Pitre
2014-05-20 13:10 ` [PATCH v9 06/14] ARM: hisi: enable HiP04 Haojian Zhuang
2014-05-20 13:10 ` [PATCH v9 07/14] document: dt: add the binding on HiP04 Haojian Zhuang
2014-05-20 13:10 ` [PATCH v9 08/14] document: dt: add the binding on HiP04 clock Haojian Zhuang
2014-05-20 13:10 ` [PATCH v9 09/14] ARM: dts: append hip04 dts Haojian Zhuang
2014-05-20 13:10 ` [PATCH v9 10/14] ARM: config: append lpae configuration Haojian Zhuang
2014-05-20 13:52 ` Gregory CLEMENT
2014-05-20 14:08 ` Alexandre Belloni
2014-05-20 18:19 ` Olof Johansson
2014-05-20 13:10 ` [PATCH v9 11/14] ARM: config: append hip04_defconfig Haojian Zhuang
2014-05-20 13:10 ` [PATCH v9 12/14] ARM: config: select ARCH_HISI in hi3xxx_defconfig Haojian Zhuang
2014-05-20 13:10 ` [PATCH v9 13/14] ARM: hisi: enable erratum 798181 of A15 on HiP04 Haojian Zhuang
2014-05-20 13:10 ` [PATCH v9 14/14] virt: arm: support hip04 gic Haojian Zhuang
2014-05-20 13:34 ` Haojian Zhuang
2014-05-20 13:44 ` Christoffer Dall
2014-05-20 13:52 ` Haojian Zhuang
2014-05-20 14:01 ` Christoffer Dall
2014-05-20 14:16 ` Haojian Zhuang
2014-05-20 15:05 ` Christoffer Dall
2014-05-20 15:39 ` Haojian Zhuang
2014-05-21 9:02 ` Christoffer Dall
2014-05-21 9:47 ` Haojian Zhuang
2014-05-21 9:55 ` Christoffer Dall [this message]
2014-05-21 13:11 ` Marc Zyngier
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=20140521095541.GC39503@lvm \
--to=christoffer.dall@linaro.org \
--cc=linux-arm-kernel@lists.infradead.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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).