Re: [PATCH 7/7] KVM: arm64: Add irq_inject counter for kvm_stat

2021-03-23 Thread Yoan Picchi
Hi Mark. Thanks for all the reviews. I am a beginner and you gave me a lot to learn about. I will reply to the other patch progressively once I understand better the issues. On 23/03/2021 17:37, Marc Zyngier wrote: On Fri, 19 Mar 2021 16:17:11 +, Yoan Picchi wrote: Add a counter for in

Re: [PATCH 7/7] KVM: arm64: Add irq_inject counter for kvm_stat

2021-03-23 Thread Marc Zyngier
On Tue, 23 Mar 2021 17:53:42 +, Yoan Picchi wrote: > > Hi Mark. s/k/c/, please! > > Thanks for all the reviews. I am a beginner and you gave me a lot to > learn about. I will reply to the other patch progressively once I > understand better the issues. I think you should consider what I

Re: [PATCH 0/7] KVM: arm64: add more event counters for kvm_stat

2021-03-23 Thread Marc Zyngier
Hi Yoan, On Fri, 19 Mar 2021 16:17:04 +, Yoan Picchi wrote: > > Hi all, > > As mentioned in the KVM forum talk from 2019 > (https://kvmforum2019.sched.com/event/Tmwf/kvmstat-and-beyond-past-present-and-future-of-performance-monitoring-christian-borntrager-ibm > page 10), there is few event

[PATCH v2] KVM: arm64: Initialize VCPU mdcr_el2 before loading it

2021-03-23 Thread Alexandru Elisei
When a VCPU is created, the kvm_vcpu struct is initialized to zero in kvm_vm_ioctl_create_vcpu(). On VHE systems, the first time vcpu.arch.mdcr_el2 is loaded on hardware is in vcpu_load(), before it is set to a sensible value in kvm_arm_setup_debug() later in the run loop. The result is that KVM ex

Re: [PATCH 7/7] KVM: arm64: Add irq_inject counter for kvm_stat

2021-03-23 Thread Marc Zyngier
On Fri, 19 Mar 2021 16:17:11 +, Yoan Picchi wrote: > > Add a counter for interrupt injections. That is when kvm relay an > interrupt to the guest (for instance a timer, or a device interrupt > like from a network card) > > Signed-off-by: Yoan Picchi > --- > arch/arm64/include/asm/kvm_host.

Re: [PATCH 6/7] KVM: arm64: Add stage2_unmap_vm counter for kvm_stat

2021-03-23 Thread Marc Zyngier
On Fri, 19 Mar 2021 16:17:10 +, Yoan Picchi wrote: > > Add a counter for when the one want to unmap all the ram of a VM. > This mostly happens when one restart a VM so we make sure to clear > the ram and free the memory for other VMs. Again: unmapping memory from a VM doesn't make it free fo

Re: [PATCH 5/7] KVM: arm64: Add memory_slot_unmaped counter for kvm_stat

2021-03-23 Thread Marc Zyngier
On Fri, 19 Mar 2021 16:17:09 +, Yoan Picchi wrote: > > Add a counter for when a memory slot is unmapped, meaning that all > memory belonging to a specific VM is made available to be mapped for > anoother VM. No. It just means it is unmapped from the guest. The VMM still has the pages. > A m

Re: [PATCH 4/7] KVM: arm64: Add flush_all_cache_lines counter for kvm_stat

2021-03-23 Thread Marc Zyngier
On Fri, 19 Mar 2021 16:17:08 +, Yoan Picchi wrote: > > Add a counter that triggers when all the cache are flushed. This happens > when toggling caching for instance. Which cache? > > Signed-off-by: Yoan Picchi > --- > arch/arm64/include/asm/kvm_host.h | 1 + > arch/arm64/kvm/guest.c

Re: [PATCH 3/7] KVM: arm64: Add cached_page_invalidated counter for kvm_stat

2021-03-23 Thread Marc Zyngier
On Fri, 19 Mar 2021 16:17:07 +, Yoan Picchi wrote: > > Add some counter for when a dpage get invalidated. The counter isn't > in the function that actually do it though because it doesn't have > either a kvm or vcpu argument, so we would have no way to access the > counters. For this reason,

Re: [PATCH 2/7] KVM: arm64: Add remote_tlb_flush counter for kvm_stat

2021-03-23 Thread Marc Zyngier
On Fri, 19 Mar 2021 16:17:06 +, Yoan Picchi wrote: > > Add a counter for remote tlb flushes. > I think flushing the tlb is important enough of a thing so that one using > kvm_stat should be aware if their code is trigering several flushes. > Beside the event is recorded in x86 and ppc as well

Re: [PATCH 1/7] KVM: arm64: Add two page mapping counters for kvm_stat

2021-03-23 Thread Marc Zyngier
On Tue, 23 Mar 2021 11:52:38 +, Keqian Zhu wrote: > > Hi Yoan, > > On 2021/3/20 0:17, Yoan Picchi wrote: > > Add a counter for when a regular page is mapped, and another > > for when a huge page is mapped. > > > > Signed-off-by: Yoan Picchi > > --- > > arch/arm64/include/asm/kvm_host.h |

Re: [kvm-unit-tests PATCH v2 2/6] arm/arm64: Remove dcache_line_size global variable

2021-03-23 Thread Andre Przywara
On Mon, 22 Mar 2021 15:06:37 + Alexandru Elisei wrote: > Compute the dcache line size when doing dcache maintenance instead of using > a global variable computed in setup(), which allows us to do dcache > maintenance at any point in the boot process. This will be useful for > running as an EF

[PATCH] KVM: arm64: Fix CPU interface MMIO compatibility detection

2021-03-23 Thread Marc Zyngier
In order to detect whether a GICv3 CPU interface is MMIO capable, we switch ICC_SRE_EL1.SRE to 0 and check whether it sticks. However, this is only possible if *ALL* of the HCR_EL2 interrupt overrides are set, and the CPU is perfectly allowed to ignore the write to ICC_SRE_EL1 otherwise. This lead

Re: [RFC PATCH v3 10/16] KVM: arm64: Add a new VM device control group for SPE

2021-03-23 Thread Alexandru Elisei
Hi James, Sorry for taking so long to reply to this, been busy with other things, but your comments have been very helpful and they gave me a lot to think about. For the next iteration of the series I've decided to use pin_user_pages with the FOLL_LONGTERM flags, similar to how vfio_iommu_type1 do

Re: [PATCH v2 3/3] KVM: arm64: Drop the CPU_FTR_REG_HYP_COPY infrastructure

2021-03-23 Thread Quentin Perret
On Monday 22 Mar 2021 at 17:56:39 (+), Marc Zyngier wrote: > Now that the read_ctr macro has been specialised for nVHE, > the whole CPU_FTR_REG_HYP_COPY infrastrcture looks completely > overengineered. > > Simplify it by populating the two u64 quantities (MMFR0 and 1) > that the hypervisor nee

Re: [PATCH 2/3] KVM: arm64: Generate final CTR_EL0 value when running in Protected mode

2021-03-23 Thread Quentin Perret
Hi Marc, On Monday 22 Mar 2021 at 18:37:14 (+), Marc Zyngier wrote: > Can't say I'm keen on the yucky bit, but here's an alternative (ha!) > for you: > > diff --git a/arch/arm64/include/asm/assembler.h > b/arch/arm64/include/asm/assembler.h > index 1a4cee7eb3c9..7582c3bd2f05 100644 > --- a/a

Re: [PATCH 1/7] KVM: arm64: Add two page mapping counters for kvm_stat

2021-03-23 Thread Keqian Zhu
Hi Yoan, On 2021/3/20 0:17, Yoan Picchi wrote: > Add a counter for when a regular page is mapped, and another > for when a huge page is mapped. > > Signed-off-by: Yoan Picchi > --- > arch/arm64/include/asm/kvm_host.h | 2 ++ > arch/arm64/kvm/guest.c| 2 ++ > arch/arm64/kvm/mmu.c

Re: [Linuxarm] Re: [PATCH v14 07/13] iommu/smmuv3: Implement cache_invalidate

2021-03-23 Thread chenxiang (M)
Hi Eric, 在 2021/3/22 17:05, Auger Eric 写道: Hi Chenxiang, On 3/22/21 7:40 AM, chenxiang (M) wrote: Hi Eric, 在 2021/3/20 1:36, Auger Eric 写道: Hi Chenxiang, On 3/4/21 8:55 AM, chenxiang (M) wrote: Hi Eric, 在 2021/2/24 4:56, Eric Auger 写道: Implement domain-selective, pasid selective and p