From mboxrd@z Thu Jan 1 00:00:00 1970 From: Will Deacon Subject: Re: [PATCH v3 1/1] KVM: ARM64: Fix the issues when guest PMCCFILTR is configured Date: Thu, 17 Nov 2016 13:30:39 +0000 Message-ID: <20161117133039.GH22855@arm.com> References: <1479316160-8567-1-git-send-email-wei@redhat.com> Mime-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Return-path: Received: from localhost (localhost [127.0.0.1]) by mm01.cs.columbia.edu (Postfix) with ESMTP id 422274022C for ; Thu, 17 Nov 2016 08:30:09 -0500 (EST) Received: from mm01.cs.columbia.edu ([127.0.0.1]) by localhost (mm01.cs.columbia.edu [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id iHJLk0dMz8yz for ; Thu, 17 Nov 2016 08:30:08 -0500 (EST) Received: from foss.arm.com (foss.arm.com [217.140.101.70]) by mm01.cs.columbia.edu (Postfix) with ESMTP id 05B72401E8 for ; Thu, 17 Nov 2016 08:30:07 -0500 (EST) Content-Disposition: inline In-Reply-To: <1479316160-8567-1-git-send-email-wei@redhat.com> List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: kvmarm-bounces@lists.cs.columbia.edu Sender: kvmarm-bounces@lists.cs.columbia.edu To: Wei Huang Cc: kvm@vger.kernel.org, marc.zyngier@arm.com, catalin.marinas@arm.com, linux-kernel@vger.kernel.org, linux-arm-kernel@lists.infradead.org, kvmarm@lists.cs.columbia.edu, shannon.zhao@linaro.org List-Id: kvmarm@lists.cs.columbia.edu On Wed, Nov 16, 2016 at 11:09:20AM -0600, Wei Huang wrote: > KVM calls kvm_pmu_set_counter_event_type() when PMCCFILTR is configured. > But this function can't deals with PMCCFILTR correctly because the evtCount > bits of PMCCFILTR, which is reserved 0, conflits with the SW_INCR event > type of other PMXEVTYPER registers. To fix it, when eventsel == 0, this > function shouldn't return immediately; instead it needs to check further > if select_idx is ARMV8_PMU_CYCLE_IDX. > > Another issue is that KVM shouldn't copy the eventsel bits of PMCCFILTER > blindly to attr.config. Instead it ought to convert the request to the > "cpu cycle" event type (i.e. 0x11). > > To support this patch and to prevent duplicated definitions, a limited > set of ARMv8 perf event types were relocated from perf_event.c to > asm/perf_event.h. > > Signed-off-by: Wei Huang > --- > arch/arm64/include/asm/perf_event.h | 10 +++++++++- > arch/arm64/kernel/perf_event.c | 10 +--------- > virt/kvm/arm/pmu.c | 8 +++++--- > 3 files changed, 15 insertions(+), 13 deletions(-) Acked-by: Will Deacon I'm assuming this will go via kvm-arm. Will From mboxrd@z Thu Jan 1 00:00:00 1970 From: will.deacon@arm.com (Will Deacon) Date: Thu, 17 Nov 2016 13:30:39 +0000 Subject: [PATCH v3 1/1] KVM: ARM64: Fix the issues when guest PMCCFILTR is configured In-Reply-To: <1479316160-8567-1-git-send-email-wei@redhat.com> References: <1479316160-8567-1-git-send-email-wei@redhat.com> Message-ID: <20161117133039.GH22855@arm.com> To: linux-arm-kernel@lists.infradead.org List-Id: linux-arm-kernel.lists.infradead.org On Wed, Nov 16, 2016 at 11:09:20AM -0600, Wei Huang wrote: > KVM calls kvm_pmu_set_counter_event_type() when PMCCFILTR is configured. > But this function can't deals with PMCCFILTR correctly because the evtCount > bits of PMCCFILTR, which is reserved 0, conflits with the SW_INCR event > type of other PMXEVTYPER registers. To fix it, when eventsel == 0, this > function shouldn't return immediately; instead it needs to check further > if select_idx is ARMV8_PMU_CYCLE_IDX. > > Another issue is that KVM shouldn't copy the eventsel bits of PMCCFILTER > blindly to attr.config. Instead it ought to convert the request to the > "cpu cycle" event type (i.e. 0x11). > > To support this patch and to prevent duplicated definitions, a limited > set of ARMv8 perf event types were relocated from perf_event.c to > asm/perf_event.h. > > Signed-off-by: Wei Huang > --- > arch/arm64/include/asm/perf_event.h | 10 +++++++++- > arch/arm64/kernel/perf_event.c | 10 +--------- > virt/kvm/arm/pmu.c | 8 +++++--- > 3 files changed, 15 insertions(+), 13 deletions(-) Acked-by: Will Deacon I'm assuming this will go via kvm-arm. Will From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1754600AbcKQRHb (ORCPT ); Thu, 17 Nov 2016 12:07:31 -0500 Received: from foss.arm.com ([217.140.101.70]:56320 "EHLO foss.arm.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1754555AbcKQRHZ (ORCPT ); Thu, 17 Nov 2016 12:07:25 -0500 Date: Thu, 17 Nov 2016 13:30:39 +0000 From: Will Deacon To: Wei Huang Cc: kvmarm@lists.cs.columbia.edu, linux-arm-kernel@lists.infradead.org, shannon.zhao@linaro.org, kvm@vger.kernel.org, marc.zyngier@arm.com, christoffer.dall@linaro.org, drjones@redhat.com, cov@codeaurora.org, mark.rutland@arm.com, catalin.marinas@arm.com, linux-kernel@vger.kernel.org Subject: Re: [PATCH v3 1/1] KVM: ARM64: Fix the issues when guest PMCCFILTR is configured Message-ID: <20161117133039.GH22855@arm.com> References: <1479316160-8567-1-git-send-email-wei@redhat.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <1479316160-8567-1-git-send-email-wei@redhat.com> User-Agent: Mutt/1.5.23 (2014-03-12) Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Wed, Nov 16, 2016 at 11:09:20AM -0600, Wei Huang wrote: > KVM calls kvm_pmu_set_counter_event_type() when PMCCFILTR is configured. > But this function can't deals with PMCCFILTR correctly because the evtCount > bits of PMCCFILTR, which is reserved 0, conflits with the SW_INCR event > type of other PMXEVTYPER registers. To fix it, when eventsel == 0, this > function shouldn't return immediately; instead it needs to check further > if select_idx is ARMV8_PMU_CYCLE_IDX. > > Another issue is that KVM shouldn't copy the eventsel bits of PMCCFILTER > blindly to attr.config. Instead it ought to convert the request to the > "cpu cycle" event type (i.e. 0x11). > > To support this patch and to prevent duplicated definitions, a limited > set of ARMv8 perf event types were relocated from perf_event.c to > asm/perf_event.h. > > Signed-off-by: Wei Huang > --- > arch/arm64/include/asm/perf_event.h | 10 +++++++++- > arch/arm64/kernel/perf_event.c | 10 +--------- > virt/kvm/arm/pmu.c | 8 +++++--- > 3 files changed, 15 insertions(+), 13 deletions(-) Acked-by: Will Deacon I'm assuming this will go via kvm-arm. Will