From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-7.0 required=3.0 tests=DKIMWL_WL_HIGH,DKIM_SIGNED, DKIM_VALID,INCLUDES_PATCH,MAILING_LIST_MULTI,SIGNED_OFF_BY,SPF_HELO_NONE, SPF_PASS autolearn=unavailable autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 87977C10F27 for ; Tue, 10 Mar 2020 11:54:57 +0000 (UTC) Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id 5CAB62468E for ; Tue, 10 Mar 2020 11:54:57 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=lists.infradead.org header.i=@lists.infradead.org header.b="hMjgB1yO"; dkim=fail reason="signature verification failed" (1024-bit key) header.d=kernel.org header.i=@kernel.org header.b="j3UGAoUo" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 5CAB62468E Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=kernel.org Authentication-Results: mail.kernel.org; spf=none smtp.mailfrom=linux-arm-kernel-bounces+infradead-linux-arm-kernel=archiver.kernel.org@lists.infradead.org DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20170209; h=Sender:Content-Type: Content-Transfer-Encoding:Cc:List-Subscribe:List-Help:List-Post:List-Archive: List-Unsubscribe:List-Id:Message-ID:References:In-Reply-To:Subject:To:From: Date:MIME-Version:Reply-To:Content-ID:Content-Description:Resent-Date: Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:List-Owner; bh=uci3u3mjLTwZo+lFfvcl4JfZ5vfrPW/scJdX4xJMsNE=; b=hMjgB1yOsDxjPn7aROTqjjDN3 ORzf7AdmmxTx36fHC1HQRC6Lra6gZ2jB+OqbMhzmYNDydNmhFPpHczpYQGUegAqgpqiOlHy9AA76Z r7ptDLl3AmDRlrPnSz3oA7LaH4tSNizLtZre0dwmGoQmqso6KButOpGQCQNrtAiXYrfKq0KB5ZFCW ak0wHr76c15dITIyRpuQqyODu9wbAYFfzoIQNCA5ZV6C/pQtjRDq8MWzGOr+6JUILjEdHqq07zTgV IV+sNXCSoyOWu2bhE5TpNsfSpIyD5G4BsyjFD7aGqTiOPw21LW1EsBj44T66s0ybLRAAHE1uHkIVq ihA3rYRbQ==; Received: from localhost ([127.0.0.1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.92.3 #3 (Red Hat Linux)) id 1jBdTK-0003WN-Hs; Tue, 10 Mar 2020 11:54:54 +0000 Received: from mail.kernel.org ([198.145.29.99]) by bombadil.infradead.org with esmtps (Exim 4.92.3 #3 (Red Hat Linux)) id 1jBdTH-0003Vv-RU for linux-arm-kernel@lists.infradead.org; Tue, 10 Mar 2020 11:54:53 +0000 Received: from disco-boy.misterjones.org (disco-boy.misterjones.org [51.254.78.96]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPSA id 49D5B2464B; Tue, 10 Mar 2020 11:54:51 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1583841291; bh=oHt26cI0evbqGQu3N7YOlcKoUwgoa88DrVqzHJqkdEw=; h=Date:From:To:Cc:Subject:In-Reply-To:References:From; b=j3UGAoUogik5p9i5EPRsvGFc8i4r+/KdQnG9teAjKg3+Ld3RyOoDWINtKMATN8Z9k kZ1UniPntVhawKyyaOl0XqSyHRs1u016YYBMkpBKfVXVZ82CFWwQRJlWU3vPvA6akY 00fJiFeTZYd2IGtSz1+9hLWDFvkvESMmIdfjsvl0= Received: from disco-boy.misterjones.org ([51.254.78.96] helo=www.loen.fr) by disco-boy.misterjones.org with esmtpsa (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.92) (envelope-from ) id 1jBdTF-00BYBZ-DK; Tue, 10 Mar 2020 11:54:49 +0000 MIME-Version: 1.0 Date: Tue, 10 Mar 2020 11:54:49 +0000 From: Marc Zyngier To: Auger Eric Subject: Re: [PATCH v2 2/2] KVM: arm64: Document PMU filtering API In-Reply-To: <7943c896-013b-d9cb-ba89-2040b46437fe@redhat.com> References: <20200309124837.19908-1-maz@kernel.org> <20200309124837.19908-3-maz@kernel.org> <7943c896-013b-d9cb-ba89-2040b46437fe@redhat.com> Message-ID: <07f4ef9b5ff6c6c5086c9723c64c035f@kernel.org> X-Sender: maz@kernel.org User-Agent: Roundcube Webmail/1.3.10 X-SA-Exim-Connect-IP: 51.254.78.96 X-SA-Exim-Rcpt-To: eric.auger@redhat.com, linux-arm-kernel@lists.infradead.org, kvmarm@lists.cs.columbia.edu, kvm@vger.kernel.org, james.morse@arm.com, julien.thierry.kdev@gmail.com, suzuki.poulose@arm.com, robin.murphy@arm.com, mark.rutland@arm.com X-SA-Exim-Mail-From: maz@kernel.org X-SA-Exim-Scanned: No (on disco-boy.misterjones.org); SAEximRunCond expanded to false X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20200310_045451_924866_3E01CABD X-CRM114-Status: GOOD ( 17.01 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Mark Rutland , kvm@vger.kernel.org, Suzuki K Poulose , James Morse , linux-arm-kernel@lists.infradead.org, Robin Murphy , kvmarm@lists.cs.columbia.edu, Julien Thierry Content-Transfer-Encoding: 7bit Content-Type: text/plain; charset="us-ascii"; Format="flowed" Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+infradead-linux-arm-kernel=archiver.kernel.org@lists.infradead.org On 2020-03-09 18:17, Auger Eric wrote: > Hi Marc, > > On 3/9/20 1:48 PM, Marc Zyngier wrote: >> Add a small blurb describing how the event filtering API gets used. >> >> Signed-off-by: Marc Zyngier >> --- >> Documentation/virt/kvm/devices/vcpu.rst | 40 >> +++++++++++++++++++++++++ >> 1 file changed, 40 insertions(+) >> >> diff --git a/Documentation/virt/kvm/devices/vcpu.rst >> b/Documentation/virt/kvm/devices/vcpu.rst >> index 9963e680770a..7262c0469856 100644 >> --- a/Documentation/virt/kvm/devices/vcpu.rst >> +++ b/Documentation/virt/kvm/devices/vcpu.rst >> @@ -55,6 +55,46 @@ Request the initialization of the PMUv3. If using >> the PMUv3 with an in-kernel >> virtual GIC implementation, this must be done after initializing the >> in-kernel >> irqchip. >> >> +1.3 ATTRIBUTE: KVM_ARM_VCPU_PMU_V3_FILTER >> +--------------------------------------- >> + >> +:Parameters: in kvm_device_attr.addr the address for a PMU event >> filter is a >> + pointer to a struct kvm_pmu_event_filter >> + >> +:Returns: >> + >> + ======= ====================================================== >> + -ENODEV: PMUv3 not supported or GIC not initialized >> + -ENXIO: PMUv3 not properly configured or in-kernel irqchip not >> + configured as required prior to calling this attribute >> + -EBUSY: PMUv3 already initialized > maybe document -EINVAL? Yup, definitely. >> + ======= ====================================================== >> + >> +Request the installation of a PMU event filter describe as follows: > s/describe/described >> + >> +struct kvm_pmu_event_filter { >> + __u16 base_event; >> + __u16 nevents; >> + >> +#define KVM_PMU_EVENT_ALLOW 0 >> +#define KVM_PMU_EVENT_DENY 1 >> + >> + __u8 action; >> + __u8 pad[3]; >> +}; >> + >> +A filter range is defined as the range [@base_event, @base_event + >> @nevents[, >> +together with an @action (KVM_PMU_EVENT_ALLOW or KVM_PMU_EVENT_DENY). >> The >> +first registered range defines the global policy (global ALLOW if the >> first >> +@action is DENY, global DENY if the first @action is ALLOW). Multiple >> ranges >> +can be programmed, and must fit within the 16bit space defined by the >> ARMv8.1 >> +PMU architecture. > what about before 8.1 where the range was 10 bits? Should it be tested > in the code? It's a good point. We could test that upon installing the filter and limit the bitmap allocation to the minimum. > nitpicking: It is not totally obvious what does happen if the user > space > sets a deny filter on a range and then an allow filter on the same > range. it is supported but may be worth telling so? Also explain the > the > default filtering remains "allow" by default? Overlapping filters are easy: the last one wins. And yes, no filter means just that: no filter. Thanks, M. -- Jazz is not dead. It just smells funny... _______________________________________________ linux-arm-kernel mailing list linux-arm-kernel@lists.infradead.org http://lists.infradead.org/mailman/listinfo/linux-arm-kernel