Received: by 2002:a05:6358:d09b:b0:dc:cd0c:909e with SMTP id jc27csp478413rwb; Wed, 7 Dec 2022 00:41:12 -0800 (PST) X-Google-Smtp-Source: AA0mqf50suhqwLnaGQQ7Kjqmkl7rTfeUimH2rtE+C1DujWljMRo6F4hGPgq7hjHByxkzZlwZjI7f X-Received: by 2002:a17:907:2058:b0:7c1:5a5:f6c0 with SMTP id pg24-20020a170907205800b007c105a5f6c0mr6839375ejb.253.1670402472735; Wed, 07 Dec 2022 00:41:12 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1670402472; cv=none; d=google.com; s=arc-20160816; b=uvmctKbwniKii6VpedAjjr31sK6GyfoXDNcP6gKzqDT2UyHnBLuvRZdAgJVFsba+w2 F2nFO6DBa8uWMHIq98R7kphdK8MWeJL40ADqac2FTG5mW5Abku/s2RAky+1JUacx/bPS id10+HOEPiKEdXPVTS3eDwrGNiMTNflCQ3jvl3gakqKNTfgWt8R0Jx3HthEOuniNEt6D mFYjJqUfLXDCTU11OGL8pBLmQnOz0tnQhRGVT8M9SrINHL7csIub1kuffrwghd+LkZvY R88yHDZ9e80LkLa9HmrWK2JcfdBSP0C1WMMhXa1O5buGeAivTGhAtsMG7E8EZ5a5XSla kTkw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:cc:to:subject:message-id:date:from:in-reply-to :references:mime-version:dkim-signature; bh=XdquHQi7NeKqSxeiFjUW2fxeM63S3wYNudDJTs5ka/I=; b=lzml3Wco9WKdDkfP/J+b/VRTx69+x+4jnxBd9edsp/NggPCea+WK45bYBjdLTXf+P9 kkzXETO8dYvKNVedsyYhRo6E+/pyRTYaE9JLviPjufFhhflV+wDvmakrof0hc5DhJ+1P Ocdjwmqa8r1O8wgC2B9wB4kWCEUUZ6kPPOuBICjK7j59iku66/FVqwYaSC3ATpsAhaAy zUibn3QGs7/1paC9BfgTuI8a9LXcc59N2/sEupsoqXGmOX1s+yL5rsvkpUdJIyNNmD2n xeG8MoPeW4LEhnAr+8ERxeffES06dQ/q+Lyw0xFgSwNq8LxrZfsxEBZQpUlhFrH68th4 i4Lw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@atishpatra.org header.s=google header.b=YnPCekdO; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id b15-20020a056402350f00b0046311e80ebcsi4268499edd.151.2022.12.07.00.40.54; Wed, 07 Dec 2022 00:41:12 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@atishpatra.org header.s=google header.b=YnPCekdO; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229917AbiLGIGT (ORCPT + 76 others); Wed, 7 Dec 2022 03:06:19 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:51694 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229762AbiLGIGR (ORCPT ); Wed, 7 Dec 2022 03:06:17 -0500 Received: from mail-pg1-x52f.google.com (mail-pg1-x52f.google.com [IPv6:2607:f8b0:4864:20::52f]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 2517E2AC41 for ; Wed, 7 Dec 2022 00:06:16 -0800 (PST) Received: by mail-pg1-x52f.google.com with SMTP id q1so15572565pgl.11 for ; Wed, 07 Dec 2022 00:06:16 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=atishpatra.org; s=google; h=cc:to:subject:message-id:date:from:in-reply-to:references :mime-version:from:to:cc:subject:date:message-id:reply-to; bh=XdquHQi7NeKqSxeiFjUW2fxeM63S3wYNudDJTs5ka/I=; b=YnPCekdO7ZQMvJqfjISrBXD80eTFgn3TeTnSB9m7M6/qkkywTQOiSOYVaI3LvG4rjR SQ7nP30BxTBvoGvsRkE96FqHrc6c+vOCy0hdIlqpsLK4XTiheIKvr8idt+8cA/wcRr+I A6LIcSPv/RjOSIzZdbdqP0lXy5HziiVzaFVTM= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=cc:to:subject:message-id:date:from:in-reply-to:references :mime-version:x-gm-message-state:from:to:cc:subject:date:message-id :reply-to; bh=XdquHQi7NeKqSxeiFjUW2fxeM63S3wYNudDJTs5ka/I=; b=OwFOxhqrJX+poL5wJK7CuuUNshh0Wy2ue1dqPccmIhwtGi4le+2sFBR+uG70ESksva zySk7lpZPZZf932cKLrJlyd0JBN6S1CWIKGFAOAiTs/TY9jyfNVWzasE67S4vVOw09Qy C5Ic89AyI9NeEfyFlZlGXzTYmH4hPz4JgfEtepH9ywTtCBMYIFdxCNdE8j1IRiix9c8s MSE5+XOAvn7HAZq9/RSNATj9S/L79/JdpwzjvkvEI4UYtMaHvkGJ0ceGWXkmI45ZDdx6 yqX4V9Yjctc9JZHoVUs+zpP2AQ+jonicK6xujZF1AbNE3/rheV+HqIz/V8hM7HYWjVYk Q2yw== X-Gm-Message-State: ANoB5pnNoczQu+ta/HH/8c6I03GcuemgwEiP4KBBK85kF/StqBpPuk2E iUQMEt5XaGxlddhJjOcqtmCPZOw1J6aUXba1eQLV X-Received: by 2002:a62:3841:0:b0:577:22cb:1f16 with SMTP id f62-20020a623841000000b0057722cb1f16mr9614270pfa.24.1670400375616; Wed, 07 Dec 2022 00:06:15 -0800 (PST) MIME-Version: 1.0 References: <20220718170205.2972215-1-atishp@rivosinc.com> <20220718170205.2972215-9-atishp@rivosinc.com> In-Reply-To: From: Atish Patra Date: Wed, 7 Dec 2022 00:06:04 -0800 Message-ID: Subject: Re: [RFC 8/9] RISC-V: KVM: Implement perf support To: Sean Christopherson Cc: Atish Patra , linux-kernel@vger.kernel.org, Albert Ou , Anup Patel , Guo Ren , kvm-riscv@lists.infradead.org, kvm@vger.kernel.org, linux-riscv@lists.infradead.org, Mark Rutland , Palmer Dabbelt , Paul Walmsley , Will Deacon Content-Type: text/plain; charset="UTF-8" X-Spam-Status: No, score=-2.1 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_NONE, SPF_HELO_NONE,SPF_PASS autolearn=unavailable autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Fri, Dec 2, 2022 at 9:09 AM Sean Christopherson wrote: > > On Mon, Jul 18, 2022, Atish Patra wrote: > > RISC-V SBI PMU & Sscofpmf ISA extension allows supporting perf in > > the virtualization enviornment as well. KVM implementation > > relies on SBI PMU extension for most of the part while traps > > & emulates the CSRs read for counter access. > > For the benefit of non-RISCV people, the changelog (and documentation?) should > explain why RISC-V doesn't need to tap into kvm_register_perf_callbacks(). As per my understanding, kvm_register_perf_callbacks is only useful during event sampling for guests. Please let me know if I missed something. This series doesn't support sampling and guest counter overflow interrupt yet. That's why kvm_register_perf_callbacks support is missing. I will add kvm_register_perf_callbacks in the next revision along with interrupt support. > Presumably there's something in the "RISC-V SBI PMU & Sscofpmf ISA extension" spec > that allows hardware to differentiate between events that are for guest vs. host? Not directly. The Sscofpmf extension does have privilege mode specific filtering bits[1] i.e. VSINH and VUINH which will indicate if the events are specific to guest. But that is only true if the hypervisor has enabled those bits. As I said above, RISC-V do need to tap into kvm_register_perf_callbacks as well. [1] https://drive.google.com/file/d/171j4jFjIkKdj5LWcExphq4xG_2sihbfd/edit -- Regards, Atish