Received: by 2002:a05:6358:d09b:b0:dc:cd0c:909e with SMTP id jc27csp8707566rwb; Thu, 24 Nov 2022 03:18:01 -0800 (PST) X-Google-Smtp-Source: AA0mqf6TED3C5A6PvvQEtY/rHX0wV20eZ4uWWm4mjc+pygeH4MLFaoCUgNaLYCAykVWShk1auZQQ X-Received: by 2002:a17:902:8b89:b0:188:77a7:eb4 with SMTP id ay9-20020a1709028b8900b0018877a70eb4mr13997883plb.32.1669288680976; Thu, 24 Nov 2022 03:18:00 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1669288680; cv=none; d=google.com; s=arc-20160816; b=xcagtpA6FW/Sd7Ves3rGYMX8o+y3Kx0ADf8e4B01EA1QdiwO8pMoJc4Xux0KAKqXJT percIXz7OOYUFu4tjC7BpgCu8ngEpgR4aIAeUcVCqGnjmxTxLT4qZN6euZbXZCL/jfiH msLNu/KdoyQMWZipDp/38kEoO8w8YBgs5lhqpZvqEZK3wjRXHfGyxtXkgE1rlwWrM5bB gEgVxPsMYDem0ZLew0r6evZBvDFGSJO9XhOM4ukc/2GtwKBzbJIjfsaKWoyCQVIE0IfX GwO9Vd5so/86Dkqt2jjdjBAOtSgINguXyZcswDyY3I8PfOD3F08wMuW+vwIxhzqCtfOd ajwA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:in-reply-to:content-disposition:mime-version :references:message-id:subject:cc:to:from:date:dkim-signature; bh=7EpHqZSb89Ze6YQ2yo72O8+0pB4IQzPJGKW2B32FbcY=; b=lasyRS9uMpz6x+bPDST2rif04jml1mq+1+Uf5WT7WvSCRl9nIP7EIrxfYF8uc1tvmt rpUQRkv6SzeZPf/fOQJuFykNp15JHPr+kY6IjkRbWTeUln/aeOZ899uFAVrABtiyTn50 uLanrD6X6eHBs9gRQBjgpP5wJ2ezAlxn2BiRTPH7o+UKpxdlze3mo2NzvB8eL6svMeIf E8d7ZA9ruZwYCJJNqQxdUG5rnF2beKGmNMxAJPUw34z+O1jU6PgmHy6JbDih5VJspOzh 71CJ7nmmpHpxJFWPEK9G4VumMcnUQQ7iNNN4PP0WhZDs8rHgblJHZLnkQ4Zp2X2rSsEr xi3A== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@ventanamicro.com header.s=google header.b=Pk8qWjYg; 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 y191-20020a638ac8000000b004774fa3d9e0si348883pgd.269.2022.11.24.03.17.49; Thu, 24 Nov 2022 03:18:00 -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=@ventanamicro.com header.s=google header.b=Pk8qWjYg; 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 S229749AbiKXKvB (ORCPT + 86 others); Thu, 24 Nov 2022 05:51:01 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:42116 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229728AbiKXKu5 (ORCPT ); Thu, 24 Nov 2022 05:50:57 -0500 Received: from mail-ej1-x62e.google.com (mail-ej1-x62e.google.com [IPv6:2a00:1450:4864:20::62e]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 9645216FB11 for ; Thu, 24 Nov 2022 02:50:54 -0800 (PST) Received: by mail-ej1-x62e.google.com with SMTP id f18so3306842ejz.5 for ; Thu, 24 Nov 2022 02:50:54 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=ventanamicro.com; s=google; h=in-reply-to:content-disposition:mime-version:references:message-id :subject:cc:to:from:date:from:to:cc:subject:date:message-id:reply-to; bh=7EpHqZSb89Ze6YQ2yo72O8+0pB4IQzPJGKW2B32FbcY=; b=Pk8qWjYgThmkUH55ahwT7r++QkroUX2mKPPGCB42y6xGyBk7NGPZEyJyTGUbo2V93l JTvGPrRRG29bpeUV8227yH/wQ++vwqMTyYmcg0atcAcfp9+0aaC4W9a3uV9b1FAMan1c PNG72cPrt8etKQ8upv4zZu9f+apnL3mx1jbIiK6Dy0yVm4HQaz2jY8vfWzgmJWF+OvNu 5lbhAP6N0mcfXspdTYpvMrdcCNe5Sk6ka7+E9lW+0Q8Uh9xpYOoBEemceeDJEPasWqpg eApbOaHuKFvcXXqFCC1lCuwGuKcMa4MZ/6fYlycda8Nh7S0gpX1LP6TkCsxAfzl/4497 GMWQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=in-reply-to:content-disposition:mime-version:references:message-id :subject:cc:to:from:date:x-gm-message-state:from:to:cc:subject:date :message-id:reply-to; bh=7EpHqZSb89Ze6YQ2yo72O8+0pB4IQzPJGKW2B32FbcY=; b=Jy91LNGjZMpIxPK3AAU4x6pdTyg0Ji09Pt0B/nSaLVc1p4pPONuFsUwrNJ+7hdQxlr /vk4iaY9kjCvAPVqfDVKYvikBWiEciMmgvLI5zOBkhud2+3RxgiGIkmmErOnAxNWmbTy 7LBGEsBeJZEoAD1e6UC867hwhTx/m+ETV343S7CUNIt9EAx5bs3x/RWST/oT53cWFV7M s4B1itBaP+PLZY6GQuTTUx06na94j8euuGZiZGpb9a15x4KCKlaMQpBd4OtblO7cWiH1 PdwKtezNuSZuBJIyrYhntJXD03VvtUDU0fO1eqgoPpre+wkMAYZzTTXhLqw0uTPTdmzS Llpw== X-Gm-Message-State: ANoB5pk9U8BJQDz9pfC540LqJ81oB2JcUZUClq1MhInytxylChZlHx/U MuHhT/5ZrHSPzPo0EhfxVPJ+oQ== X-Received: by 2002:a17:907:c20d:b0:7b8:882d:43fc with SMTP id ti13-20020a170907c20d00b007b8882d43fcmr10034499ejc.0.1669287053134; Thu, 24 Nov 2022 02:50:53 -0800 (PST) Received: from localhost (cst2-173-16.cust.vodafone.cz. [31.30.173.16]) by smtp.gmail.com with ESMTPSA id f15-20020a50fc8f000000b00462e1d8e914sm365978edq.68.2022.11.24.02.50.52 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 24 Nov 2022 02:50:52 -0800 (PST) Date: Thu, 24 Nov 2022 11:50:51 +0100 From: Andrew Jones To: Atish Patra 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 Subject: Re: [RFC 6/9] RISC-V: KVM: Add SBI PMU extension support Message-ID: <20221124105051.hbsavj3bgf4mvlzb@kamzik> References: <20220718170205.2972215-1-atishp@rivosinc.com> <20220718170205.2972215-7-atishp@rivosinc.com> <20221101142631.du54p4kyhlgf54cr@kamzik> <20221123135842.uyw46kbybgb7unm2@kamzik> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: 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=ham 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 Thu, Nov 24, 2022 at 02:18:26AM -0800, Atish Patra wrote: > On Wed, Nov 23, 2022 at 5:58 AM Andrew Jones wrote: > > > > On Tue, Nov 22, 2022 at 03:08:34PM -0800, Atish Patra wrote: ... > > > Currently, ARM64 enables pmu from user space using device control APIs > > > on vcpu fd. > > > Are you suggesting we should do something like that ? > > > > Yes. Although choosing which KVM API should be used could probably be > > thought-out again. x86 uses VM ioctls. > > > > How does it handle hetergenous systems in per VM ioctls ? I don't think it does, but neither does arm64. Afaik, the only way to run KVM VMs on heterogeneous systems is to pin the VM to one set of the CPUs, i.e. make sure the system it runs on is homogeneous. I agree we shouldn't paint ourselves into a homogeneous-only corner for riscv, though, so if it's possible to use VCPU APIs, then I guess we should. Although, one thing to keep in mind is that if the same ioctl needs to be run on each VCPU, then, when we start building VMs with hundreds of VCPUs, we'll see slow VM starts. > > > > > > > If PMU needs to have device control APIs (either via vcpu fd or its > > > own), we can retrieve > > > the hpmcounter width and count from there as well. > > > > Right. We need to decide how the VM/VCPU + PMU user interface should look. > > A separate PMU device, like arm64 has, sounds good, but the ioctl > > sequences for initialization may get more tricky. > > > > Do we really need a per VM interface ? I was thinking we can just > continue to use > one reg interface for PMU as well. We probably need two of them. > > 1. To enable/disable SBI extension > -- The probe function will depend on this > 2. PMU specific get/set > -- Number of hpmcounters > -- hpmcounter width > -- enable PMU ONE_REG is good for registers and virtual registers, which means the number of hpmcounters and the hpmcounter width are probably good candidates, but I'm not sure we should use it for enable/init types of purposes. Thanks, drew