Re: [PATCH] KVM: arm64: Fix memory leaks from stage2 pagetable

2022-06-01 Thread Qian Cai
On Tue, May 31, 2022 at 06:01:58PM +0100, Will Deacon wrote: > Have you spotted any pattern for when the leak occurs? How are you > terminating the guest? It just to send a SIGTERM to the qemu-system-aarch64 process. Origially, right after sending the signal, it will remove_id/unbind from the vfio

Re: [PATCH] KVM: arm64: Fix memory leaks from stage2 pagetable

2022-06-01 Thread Qian Cai
On Tue, May 31, 2022 at 05:57:11PM +0100, Will Deacon wrote: > On Thu, May 26, 2022 at 04:39:56PM -0400, Qian Cai wrote: > > Running some SR-IOV workloads could trigger some leak reports from > > kmemleak. > > > > unreferenced object 0x080243cef500 (size 128):

[PATCH] KVM: arm64: Fix memory leaks from stage2 pagetable

2022-05-27 Thread Qian Cai
_stage2_pgd() from kvm_arch_flush_shadow_all() into kvm_arch_destroy_vm() due to the issue mentioned in the "Fixes" commit below. Thus, fixed it by freeing the memory from kvm_arch_destroy_vm() only if the MMU notifier is not even initialized. Fixes: 293f293637b5 ("kvm-arm: Unmap shadow pagetables p

Re: [PATCH v14 00/39] arm64/sme: Initial support for the Scalable Matrix Extension

2022-05-03 Thread Qian Cai
On Tue, Apr 19, 2022 at 12:22:08PM +0100, Mark Brown wrote: > This series provides initial support for the ARMv9 Scalable Matrix > Extension (SME). SME takes the approach used for vectors in SVE and > extends this to provide architectural support for matrix operations. A > more detailed overview

Re: [PATCH v14 00/39] arm64/sme: Initial support for the Scalable Matrix Extension

2022-04-28 Thread Qian Cai
On Tue, Apr 19, 2022 at 12:22:08PM +0100, Mark Brown wrote: > This series provides initial support for the ARMv9 Scalable Matrix > Extension (SME). SME takes the approach used for vectors in SVE and > extends this to provide architectural support for matrix operations. A > more detailed overview

Re: [PATCH v14 00/39] arm64/sme: Initial support for the Scalable Matrix Extension

2022-04-28 Thread Qian Cai
On Wed, Apr 27, 2022 at 06:14:31PM +0100, Mark Brown wrote: > On Wed, Apr 27, 2022 at 01:08:58PM -0400, Qian Cai wrote: > > On Tue, Apr 19, 2022 at 12:22:08PM +0100, Mark Brown wrote: > > > > but not SVE, SME is an ARMv9 feature and SVE is mandatory for ARMv9. > > &g

Re: [PATCH v11 03/40] arm64: cpufeature: Always specify and use a field width for capabilities

2022-03-02 Thread Qian Cai
On Mon, Feb 07, 2022 at 03:20:32PM +, Mark Brown wrote: > Since all the fields in the main ID registers are 4 bits wide we have up > until now not bothered specifying the width in the code. Since we now > wish to use this mechanism to enumerate features from the floating point > feature registe

Re: [PATCH] KVM: arm64: Remove unused TRNG_NO_ENTROPY

2021-10-27 Thread Qian Cai
On 10/27/21 3:46 AM, Marc Zyngier wrote: > That's an architectural definition that doesn't cause any problem. > If anything, that's documentation. > > We have *tons* of other definitions with no user all over the > arm64 code. They save the exact same purpose. Understood. Thanks for the quick

Re: [PATCH] KVM: arm64: Avoid shadowing a previous local

2021-10-27 Thread Qian Cai
On 10/27/21 3:34 AM, Marc Zyngier wrote: > I don't think this makes much sense. This is bound to eventually clash > with another variable, and you're back to square one. Yes, perhaps. We don't have a namespace feature in C. Thanks for taking a look, Marc. ___

[PATCH] KVM: arm64: Remove unused TRNG_NO_ENTROPY

2021-10-27 Thread Qian Cai
TRNG_NO_ENTROPY was unused when introduced and now. This is also caught by GCC (W=2): arch/arm64/kvm/trng.c:17: warning: macro "TRNG_NO_ENTROPY" is not used [-Wunused-macros] 17 | #define TRNG_NO_ENTROPY ((unsigned long)-3) Signed-off-by: Qian Cai --- arch/arm64/kvm/trng.c | 1

[PATCH] KVM: arm64: Avoid shadowing a previous local

2021-10-27 Thread Qian Cai
l_hyp_ret(__kvm_vcpu_run, vcpu); | ^~~~ arch/arm64/kvm/arm.c:773:6: note: shadowed declaration is here 773 | int ret; | ^~~ Signed-off-by: Qian Cai --- arch/arm64/include/asm/kvm_host.h | 8 1 file changed, 4 insertions(+), 4 deletions(-) diff

Re: [PATCH] KVM: arm64: Don't access PMCR_EL0 when no PMU is available

2021-01-04 Thread Qian Cai
On Mon, 2021-01-04 at 18:26 +, Marc Zyngier wrote: > What I'm suggesting is this [1], which is to get rid of KVM_ARM_PMU > completely. At least, the kernel configuration will be consistent. > Do you have a patch for CONFIG_KVM to select HW_PERF_EVENTS then? I could cook one if not. > Overall

Re: [PATCH] KVM: arm64: Don't access PMCR_EL0 when no PMU is available

2021-01-04 Thread Qian Cai
On Mon, 2021-01-04 at 16:27 +, Marc Zyngier wrote: > On 2021-01-04 16:22, Qian Cai wrote: > > On Mon, 2021-01-04 at 16:08 +, Marc Zyngier wrote: > > > On 2021-01-04 15:47, Qian Cai wrote: > > > > On Thu, 2020-12-10 at 08:30 +, Marc Zyngier wrote: > >

Re: [PATCH] KVM: arm64: Don't access PMCR_EL0 when no PMU is available

2021-01-04 Thread Qian Cai
On Mon, 2021-01-04 at 16:08 +, Marc Zyngier wrote: > On 2021-01-04 15:47, Qian Cai wrote: > > On Thu, 2020-12-10 at 08:30 +, Marc Zyngier wrote: > > > We reset the guest's view of PMCR_EL0 unconditionally, based on > > > the host's view of this

Re: [PATCH] KVM: arm64: Don't access PMCR_EL0 when no PMU is available

2021-01-04 Thread Qian Cai
On Thu, 2020-12-10 at 08:30 +, Marc Zyngier wrote: > We reset the guest's view of PMCR_EL0 unconditionally, based on > the host's view of this register. It is however legal for an > imnplementation not to provide any PMU, resulting in an UNDEF. > > The obvious fix is to skip the reset of this

Re: [PATCH v4 17/26] kvm: arm64: Add offset for hyp VA <-> PA conversion

2020-12-08 Thread Qian Cai
On Wed, 2020-12-02 at 18:41 +, David Brazdil wrote: > Add a host-initialized constant to KVM nVHE hyp code for converting > between EL2 linear map virtual addresses and physical addresses. > Also add `__hyp_pa` macro that performs the conversion. > > Signed-off-by: David Brazdil > --- > arch

Re: [PATCH v4 08/14] powerpc: add support for folded p4d page tables

2020-06-04 Thread Qian Cai
> On Jun 3, 2020, at 3:05 PM, Andrew Morton wrote: > > A bunch of new material just landed in linux-next/powerpc. > > The timing is awkward! I trust this will be going into mainline during > this merge window? If not, please drop it and repull after -rc1. I have noticed the same pattern ov

[PATCH] arm64/kvm: fix -Wimplicit-fallthrough warnings

2019-08-02 Thread Qian Cai
~ arch/arm64/kvm/regmap.c:187:2: note: here case KVM_SPSR_FIQ: ^~~~ Fixes: a892819560c4 ("KVM: arm64: Prepare to handle deferred save/restore of 32-bit registers") Signed-off-by: Qian Cai --- arch/arm64/kvm/regmap.c | 7 +++ 1 file changed, 7 insertions(+) diff --git a/