* [PATCH] updated: arm64: KVM: vgic: deal with GIC sub-page alignment
@ 2016-07-01 4:57 Itaru Kitayama
2016-07-01 8:40 ` Marc Zyngier
0 siblings, 1 reply; 10+ messages in thread
From: Itaru Kitayama @ 2016-07-01 4:57 UTC (permalink / raw)
To: kvmarm; +Cc: marc.zyngier
[-- Attachment #1.1: Type: text/plain, Size: 2435 bytes --]
This is merely an update to the patch Marc posted in 2014:
https://lists.cs.columbia.edu/pipermail/kvmarm/2014-June/010055.html
This updated patch is against today's current kvmarm git tree tag,
kvm-for-arm-v4.7-rc6.
The GIC CPU interface is always 4k aligned. If the host is using
64k pages, it is critical to place the guest's GICC interface at the
same relative alignment as the host's GICV. Failure to do so results
in an impossibility for the guest to deal with interrupts.
Add a KVM_DEV_ARM_VGIC_GRP_ADDR_OFFSET attribute for the VGIC, allowing
userspace to retrieve the GICV offset in a page. It becomes then trivial
to adjust the GICC base address for the guest.
Signed-off-by: Marc Zyngier <marc.zyngier@arm.com <https://lists.cs.columbia.edu/mailman/listinfo/kvmarm>>
Signed-off-by: Itaru Kitayama <itaru.kitayama@riken.jp>
diff --git a/arch/arm64/include/uapi/asm/kvm.h
b/arch/arm64/include/uapi/asm/kvm.h
index f209ea1..803b097 100644
--- a/arch/arm64/include/uapi/asm/kvm.h
+++ b/arch/arm64/include/uapi/asm/kvm.h
@@ -203,6 +203,7 @@ struct kvm_arch_memory_slot {
#define KVM_DEV_ARM_VGIC_OFFSET_MASK (0xffffffffULL <<
KVM_DEV_ARM_VGIC_OFFSET_SHIFT)
#define KVM_DEV_ARM_VGIC_GRP_NR_IRQS 3
#define KVM_DEV_ARM_VGIC_GRP_CTRL 4
+#define KVM_DEV_ARM_VGIC_GRP_ADDR_OFFSET 5
#define KVM_DEV_ARM_VGIC_CTRL_INIT 0
/* Device Control API on vcpu fd */
diff --git a/virt/kvm/arm/vgic/vgic-kvm-device.c
b/virt/kvm/arm/vgic/vgic-kvm-device.c
index 850eb88..3e33778 100644
--- a/virt/kvm/arm/vgic/vgic-kvm-device.c
+++ b/virt/kvm/arm/vgic/vgic-kvm-device.c
@@ -196,8 +196,14 @@ static int vgic_get_common_attr(struct kvm_device *dev,
VGIC_NR_PRIVATE_IRQS, uaddr);
break;
}
+ case KVM_DEV_ARM_VGIC_GRP_ADDR_OFFSET: {
+ u32 __user *uaddr = (u32 __user *)(long)attr->addr;
+ u32 val = kvm_vgic_global_state.vcpu_base & ~PAGE_MASK;
+ r = put_user(val, uaddr);
+ break;
}
+ }
return r;
}
@@ -362,6 +368,7 @@ static int vgic_v2_has_attr(struct kvm_device *dev,
case KVM_DEV_ARM_VGIC_GRP_CPU_REGS:
return vgic_v2_has_attr_regs(dev, attr);
case KVM_DEV_ARM_VGIC_GRP_NR_IRQS:
+ case KVM_DEV_ARM_VGIC_GRP_ADDR_OFFSET:
return 0;
case KVM_DEV_ARM_VGIC_GRP_CTRL:
switch (attr->attr) {
[-- Attachment #1.2: Type: text/html, Size: 3830 bytes --]
[-- Attachment #2: Type: text/plain, Size: 151 bytes --]
_______________________________________________
kvmarm mailing list
kvmarm@lists.cs.columbia.edu
https://lists.cs.columbia.edu/mailman/listinfo/kvmarm
^ permalink raw reply related [flat|nested] 10+ messages in thread
* Re: [PATCH] updated: arm64: KVM: vgic: deal with GIC sub-page alignment
2016-07-01 4:57 [PATCH] updated: arm64: KVM: vgic: deal with GIC sub-page alignment Itaru Kitayama
@ 2016-07-01 8:40 ` Marc Zyngier
2016-07-01 8:59 ` Itaru Kitayama
0 siblings, 1 reply; 10+ messages in thread
From: Marc Zyngier @ 2016-07-01 8:40 UTC (permalink / raw)
To: Itaru Kitayama, kvmarm
Itaru,
On 01/07/16 05:57, Itaru Kitayama wrote:
> This is merely an update to the patch Marc posted in 2014:
>
> https://lists.cs.columbia.edu/pipermail/kvmarm/2014-June/010055.html
>
> This updated patch is against today's current kvmarm git tree tag,
> kvm-for-arm-v4.7-rc6.
>
> The GIC CPU interface is always 4k aligned. If the host is using
> 64k pages, it is critical to place the guest's GICC interface at the
> same relative alignment as the host's GICV. Failure to do so results
> in an impossibility for the guest to deal with interrupts.
>
> Add a KVM_DEV_ARM_VGIC_GRP_ADDR_OFFSET attribute for the VGIC, allowing
> userspace to retrieve the GICV offset in a page. It becomes then trivial
> to adjust the GICC base address for the guest.
>
> Signed-off-by: Marc Zyngier <marc.zyngier@arm.com <https://lists.cs.columbia.edu/mailman/listinfo/kvmarm>>
> Signed-off-by: Itaru Kitayama <itaru.kitayama@riken.jp>
I'm working on a much more complete patch series that deals with this
and a bit more. Hopefully for the 4.9 time frame.
Thanks,
M.
--
Jazz is not dead. It just smells funny...
^ permalink raw reply [flat|nested] 10+ messages in thread
* Re: [PATCH] updated: arm64: KVM: vgic: deal with GIC sub-page alignment
2016-07-01 8:40 ` Marc Zyngier
@ 2016-07-01 8:59 ` Itaru Kitayama
2016-07-01 9:20 ` Marc Zyngier
0 siblings, 1 reply; 10+ messages in thread
From: Itaru Kitayama @ 2016-07-01 8:59 UTC (permalink / raw)
To: Marc Zyngier; +Cc: kvmarm
Marc,
That's good news. Can I assume you'd keep the
KVM_DEV_ARM_VGIC_GRP_ADDR_OFFSET attribute, or would you introduce new
ones? I ask because either way we need the userland support, be it QEMU
or kvmtool. I'm carrying the small QEMU patch at this moment.
On 7/1/16 5:40 PM, Marc Zyngier wrote:
> Itaru,
>
> On 01/07/16 05:57, Itaru Kitayama wrote:
>> This is merely an update to the patch Marc posted in 2014:
>>
>> https://lists.cs.columbia.edu/pipermail/kvmarm/2014-June/010055.html
>>
>> This updated patch is against today's current kvmarm git tree tag,
>> kvm-for-arm-v4.7-rc6.
>>
>> The GIC CPU interface is always 4k aligned. If the host is using
>> 64k pages, it is critical to place the guest's GICC interface at the
>> same relative alignment as the host's GICV. Failure to do so results
>> in an impossibility for the guest to deal with interrupts.
>>
>> Add a KVM_DEV_ARM_VGIC_GRP_ADDR_OFFSET attribute for the VGIC, allowing
>> userspace to retrieve the GICV offset in a page. It becomes then trivial
>> to adjust the GICC base address for the guest.
>>
>> Signed-off-by: Marc Zyngier <marc.zyngier@arm.com <https://lists.cs.columbia.edu/mailman/listinfo/kvmarm>>
>> Signed-off-by: Itaru Kitayama <itaru.kitayama@riken.jp>
>
> I'm working on a much more complete patch series that deals with this
> and a bit more. Hopefully for the 4.9 time frame.
>
> Thanks,
>
> M.
>
^ permalink raw reply [flat|nested] 10+ messages in thread
* Re: [PATCH] updated: arm64: KVM: vgic: deal with GIC sub-page alignment
2016-07-01 8:59 ` Itaru Kitayama
@ 2016-07-01 9:20 ` Marc Zyngier
2016-07-09 0:27 ` Itaru Kitayama
0 siblings, 1 reply; 10+ messages in thread
From: Marc Zyngier @ 2016-07-01 9:20 UTC (permalink / raw)
To: Itaru Kitayama; +Cc: kvmarm
On 01/07/16 09:59, Itaru Kitayama wrote:
> Marc,
> That's good news. Can I assume you'd keep the
> KVM_DEV_ARM_VGIC_GRP_ADDR_OFFSET attribute, or would you introduce new
> ones? I ask because either way we need the userland support, be it QEMU
> or kvmtool. I'm carrying the small QEMU patch at this moment.
You can look at the kvm-arm64/gicv-align branch in my tree, which
contains some of the stuff. At the moment, the attribute is named
KVM_DEV_ARM_VGIC_GRP_GICC_OFFSET, but I don't mind changing the name.
Thanks,
M.
>
>
> On 7/1/16 5:40 PM, Marc Zyngier wrote:
>> Itaru,
>>
>> On 01/07/16 05:57, Itaru Kitayama wrote:
>>> This is merely an update to the patch Marc posted in 2014:
>>>
>>> https://lists.cs.columbia.edu/pipermail/kvmarm/2014-June/010055.html
>>>
>>> This updated patch is against today's current kvmarm git tree tag,
>>> kvm-for-arm-v4.7-rc6.
>>>
>>> The GIC CPU interface is always 4k aligned. If the host is using
>>> 64k pages, it is critical to place the guest's GICC interface at the
>>> same relative alignment as the host's GICV. Failure to do so results
>>> in an impossibility for the guest to deal with interrupts.
>>>
>>> Add a KVM_DEV_ARM_VGIC_GRP_ADDR_OFFSET attribute for the VGIC, allowing
>>> userspace to retrieve the GICV offset in a page. It becomes then trivial
>>> to adjust the GICC base address for the guest.
>>>
>>> Signed-off-by: Marc Zyngier <marc.zyngier@arm.com <https://lists.cs.columbia.edu/mailman/listinfo/kvmarm>>
>>> Signed-off-by: Itaru Kitayama <itaru.kitayama@riken.jp>
>>
>> I'm working on a much more complete patch series that deals with this
>> and a bit more. Hopefully for the 4.9 time frame.
>>
>> Thanks,
>>
>> M.
>>
>
--
Jazz is not dead. It just smells funny...
^ permalink raw reply [flat|nested] 10+ messages in thread
* Re: [PATCH] updated: arm64: KVM: vgic: deal with GIC sub-page alignment
2016-07-01 9:20 ` Marc Zyngier
@ 2016-07-09 0:27 ` Itaru Kitayama
2016-07-09 0:34 ` Itaru Kitayama
2016-07-09 10:08 ` Marc Zyngier
0 siblings, 2 replies; 10+ messages in thread
From: Itaru Kitayama @ 2016-07-09 0:27 UTC (permalink / raw)
To: Marc Zyngier; +Cc: kvmarm
Marc,
I'm at the latest commit, fa9301d in the gicv-align branch at the
moment, with that an unmodified QEMU guest boots fine on a 64Kb page
granular host, thanks to the trapping you introduced.
(I wanted to get some performance statistics of the new feature with
perf, but on arm64 most of them are unsupported)
However, if I rebuild the kernel using defconfig with only the kernel
page size changed to 16Kb it does not boot at least on Overdrive 3000.
On 7/1/16 6:20 PM, Marc Zyngier wrote:
> On 01/07/16 09:59, Itaru Kitayama wrote:
>> Marc,
>> That's good news. Can I assume you'd keep the
>> KVM_DEV_ARM_VGIC_GRP_ADDR_OFFSET attribute, or would you introduce new
>> ones? I ask because either way we need the userland support, be it QEMU
>> or kvmtool. I'm carrying the small QEMU patch at this moment.
>
> You can look at the kvm-arm64/gicv-align branch in my tree, which
> contains some of the stuff. At the moment, the attribute is named
> KVM_DEV_ARM_VGIC_GRP_GICC_OFFSET, but I don't mind changing the name.
>
> Thanks,
>
> M.
^ permalink raw reply [flat|nested] 10+ messages in thread
* Re: [PATCH] updated: arm64: KVM: vgic: deal with GIC sub-page alignment
2016-07-09 0:27 ` Itaru Kitayama
@ 2016-07-09 0:34 ` Itaru Kitayama
2016-07-09 10:08 ` Marc Zyngier
1 sibling, 0 replies; 10+ messages in thread
From: Itaru Kitayama @ 2016-07-09 0:34 UTC (permalink / raw)
To: Marc Zyngier; +Cc: kvmarm
Forgot to mention that all tests/attempts were done on an ACPI-based
system.
On 7/9/16 9:27 AM, Itaru Kitayama wrote:
> Marc,
>
> I'm at the latest commit, fa9301d in the gicv-align branch at the
> moment, with that an unmodified QEMU guest boots fine on a 64Kb page
> granular host, thanks to the trapping you introduced.
> (I wanted to get some performance statistics of the new feature with
> perf, but on arm64 most of them are unsupported)
>
> However, if I rebuild the kernel using defconfig with only the kernel
> page size changed to 16Kb it does not boot at least on Overdrive 3000.
>
>
> On 7/1/16 6:20 PM, Marc Zyngier wrote:
>> On 01/07/16 09:59, Itaru Kitayama wrote:
>>> Marc,
>>> That's good news. Can I assume you'd keep the
>>> KVM_DEV_ARM_VGIC_GRP_ADDR_OFFSET attribute, or would you introduce new
>>> ones? I ask because either way we need the userland support, be it QEMU
>>> or kvmtool. I'm carrying the small QEMU patch at this moment.
>>
>> You can look at the kvm-arm64/gicv-align branch in my tree, which
>> contains some of the stuff. At the moment, the attribute is named
>> KVM_DEV_ARM_VGIC_GRP_GICC_OFFSET, but I don't mind changing the name.
>>
>> Thanks,
>>
>> M.
^ permalink raw reply [flat|nested] 10+ messages in thread
* Re: [PATCH] updated: arm64: KVM: vgic: deal with GIC sub-page alignment
2016-07-09 0:27 ` Itaru Kitayama
2016-07-09 0:34 ` Itaru Kitayama
@ 2016-07-09 10:08 ` Marc Zyngier
2016-07-09 10:32 ` Itaru Kitayama
1 sibling, 1 reply; 10+ messages in thread
From: Marc Zyngier @ 2016-07-09 10:08 UTC (permalink / raw)
To: Itaru Kitayama; +Cc: kvmarm
On Sat, 9 Jul 2016 09:27:21 +0900
Itaru Kitayama <itaru.kitayama@riken.jp> wrote:
Itaru,
> I'm at the latest commit, fa9301d in the gicv-align branch at the
> moment, with that an unmodified QEMU guest boots fine on a 64Kb page
> granular host, thanks to the trapping you introduced.
Please realize that this is a work in progress, and that I'm not even
sure I want to upstream this.
> (I wanted to get some performance statistics of the new feature with
> perf, but on arm64 most of them are unsupported)
Care to mention which ones are missing?
> However, if I rebuild the kernel using defconfig with only the kernel
> page size changed to 16Kb it does not boot at least on Overdrive 3000.
Only a few CPUs support 16kB pages, and Cortex-A57 is definitely not
one of them.
Thanks,
M.
--
Jazz is not dead. It just smells funny.
^ permalink raw reply [flat|nested] 10+ messages in thread
* Re: [PATCH] updated: arm64: KVM: vgic: deal with GIC sub-page alignment
2016-07-09 10:08 ` Marc Zyngier
@ 2016-07-09 10:32 ` Itaru Kitayama
2016-07-09 20:09 ` Marc Zyngier
0 siblings, 1 reply; 10+ messages in thread
From: Itaru Kitayama @ 2016-07-09 10:32 UTC (permalink / raw)
To: Marc Zyngier; +Cc: kvmarm
On 7/9/16 7:08 PM, Marc Zyngier wrote:
> Please realize that this is a work in progress, and that I'm not even
> sure I want to upstream this.
OK.
>> (I wanted to get some performance statistics of the new feature with
>> perf, but on arm64 most of them are unsupported)
>
> Care to mention which ones are missing?
$ perf stat sleep 5
Performance counter stats for 'sleep 5':
0.589480 task-clock:u (msec) # 0.000 CPUs
utilized
0 context-switches:u # 0.000 K/sec
0 cpu-migrations:u # 0.000 K/sec
35 page-faults:u # 0.059 M/sec
<not supported> cycles:u
<not supported> instructions:u
<not supported> branches:u
<not supported> branch-misses:u
5.024683421 seconds time elapsed
Userland is Fedora 24.
> Only a few CPUs support 16kB pages, and Cortex-A57 is definitely not
> one of them.
Ah, I did not know that. Thanks.
^ permalink raw reply [flat|nested] 10+ messages in thread
* Re: [PATCH] updated: arm64: KVM: vgic: deal with GIC sub-page alignment
2016-07-09 10:32 ` Itaru Kitayama
@ 2016-07-09 20:09 ` Marc Zyngier
2016-07-10 6:49 ` Itaru Kitayama
0 siblings, 1 reply; 10+ messages in thread
From: Marc Zyngier @ 2016-07-09 20:09 UTC (permalink / raw)
To: Itaru Kitayama; +Cc: kvmarm
On Sat, 9 Jul 2016 19:32:35 +0900
Itaru Kitayama <itaru.kitayama@riken.jp> wrote:
> On 7/9/16 7:08 PM, Marc Zyngier wrote:
> > Please realize that this is a work in progress, and that I'm not even
> > sure I want to upstream this.
>
> OK.
>
> >> (I wanted to get some performance statistics of the new feature with
> >> perf, but on arm64 most of them are unsupported)
> >
> > Care to mention which ones are missing?
>
> $ perf stat sleep 5
>
> Performance counter stats for 'sleep 5':
>
> 0.589480 task-clock:u (msec) # 0.000 CPUs
> utilized
> 0 context-switches:u # 0.000 K/sec
>
> 0 cpu-migrations:u # 0.000 K/sec
>
> 35 page-faults:u # 0.059 M/sec
>
> <not supported> cycles:u
>
> <not supported> instructions:u
>
> <not supported> branches:u
>
> <not supported> branch-misses:u
>
>
> 5.024683421 seconds time elapsed
>
> Userland is Fedora 24.
I'm pretty sure your QEMU doesn't have PMU support. Can you show the
PMU probe messages in the guest? And/or dump the guest DTB?
Thanks,
M.
--
Jazz is not dead. It just smells funny.
^ permalink raw reply [flat|nested] 10+ messages in thread
* Re: [PATCH] updated: arm64: KVM: vgic: deal with GIC sub-page alignment
2016-07-09 20:09 ` Marc Zyngier
@ 2016-07-10 6:49 ` Itaru Kitayama
0 siblings, 0 replies; 10+ messages in thread
From: Itaru Kitayama @ 2016-07-10 6:49 UTC (permalink / raw)
To: Marc Zyngier; +Cc: kvmarm
I was issuing the command on host which was booted up with acpi=force.
Booting up the same system with acpi=off, the probing message is there
[ 2.106248] hw perfevents: enabled with armv8_pmuv3 PMU driver, 7
counters available
and the support is there too:
$ perf stat sleep 1
Performance counter stats for 'sleep 1':
0.624936 task-clock:u (msec) # 0.001 CPUs
utilized
0 context-switches:u # 0.000 K/sec
0 cpu-migrations:u # 0.000 K/sec
35 page-faults:u # 0.056 M/sec
389,265 cycles:u # 0.623 GHz
184,079 instructions:u # 0.47 insn per
cycle
<not supported> branches:u
4,828 branch-misses:u # 0.00% of all
branches
1.013477604 seconds time elapsed
I'll apply the PMU probing patches for ACPI platforms and see if that helps.
On 7/10/16 5:09 AM, Marc Zyngier wrote:
>>
>> $ perf stat sleep 5
>>
>> Performance counter stats for 'sleep 5':
>>
>> 0.589480 task-clock:u (msec) # 0.000 CPUs
>> utilized
>> 0 context-switches:u # 0.000 K/sec
>>
>> 0 cpu-migrations:u # 0.000 K/sec
>>
>> 35 page-faults:u # 0.059 M/sec
>>
>> <not supported> cycles:u
>>
>> <not supported> instructions:u
>>
>> <not supported> branches:u
>>
>> <not supported> branch-misses:u
>>
>>
>> 5.024683421 seconds time elapsed
>>
>> Userland is Fedora 24.
>
> I'm pretty sure your QEMU doesn't have PMU support. Can you show the
> PMU probe messages in the guest? And/or dump the guest DTB?
>
> Thanks,
>
> M.
>
^ permalink raw reply [flat|nested] 10+ messages in thread
end of thread, other threads:[~2016-07-10 6:43 UTC | newest]
Thread overview: 10+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2016-07-01 4:57 [PATCH] updated: arm64: KVM: vgic: deal with GIC sub-page alignment Itaru Kitayama
2016-07-01 8:40 ` Marc Zyngier
2016-07-01 8:59 ` Itaru Kitayama
2016-07-01 9:20 ` Marc Zyngier
2016-07-09 0:27 ` Itaru Kitayama
2016-07-09 0:34 ` Itaru Kitayama
2016-07-09 10:08 ` Marc Zyngier
2016-07-09 10:32 ` Itaru Kitayama
2016-07-09 20:09 ` Marc Zyngier
2016-07-10 6:49 ` Itaru Kitayama
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.