Received: by 2002:ab2:69cc:0:b0:1f4:be93:e15a with SMTP id n12csp1444363lqp; Mon, 15 Apr 2024 06:53:57 -0700 (PDT) X-Forwarded-Encrypted: i=3; AJvYcCWwYtFaQPMiV5zgM4BANUOco/gI3DllL4ALA0VBM2uX6REVhURtaIZ12MaIFWFLgMmhQjDCsYYbydLaz9oVEvmgfOnCJXvY0P1IpmHhKA== X-Google-Smtp-Source: AGHT+IF9MWoeVL24mCZ8SVrX3AmbxkVAeh0x/8wfAeR1/JP+cAvMW8RrQnPY/0tEvunbJ0x4Emnt X-Received: by 2002:a17:902:7687:b0:1e0:3084:6cb4 with SMTP id m7-20020a170902768700b001e030846cb4mr8236630pll.17.1713189236910; Mon, 15 Apr 2024 06:53:56 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1713189236; cv=pass; d=google.com; s=arc-20160816; b=xZ+nN04kulTMPvmZa1imueyUTKVGwLH3ABx5w+zF4YoLqGXGcM7zzYf5nfveCdvYk+ anw1s+eiHCpF/1K7E7QqvwTyr+/nmD2vITpQ/QjbVA3abZks9Y+YfRLyncAqZh/TvGbA 1Tecb2+iK04uy7JEDVLo1/fyFJdDB0/jfjKV6p2CGrG2mqlplm/RavNZ2/Jp35BWHEyq GTfnid8/AN3yUuMUvfMP0e69BOyp9fEGWtxWGgD84FLsZd3tYuz9oJS3dYV2AgoF4R2f lPGcdBqta3CeLfl5xrEJ0KM1/funJaXyxgFw/EYvjyeRGYKt5kA8KsBKfziaYm7zwHN7 DYuw== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=in-reply-to:content-disposition:mime-version:list-unsubscribe :list-subscribe:list-id:precedence:references:message-id:subject:cc :to:from:date:dkim-signature; bh=SsPjsW5vGyGQYslNcZfnPrf8zdlh6X3WXkIuouRF3Dg=; fh=0qSLV9AqI6DfSKYlBcT4EOqioreHJ9ziUZfg3kErA9g=; b=H8CaiAvoMS6VGaongDu/cG04m6Ie0JUQ4j5ttlJlgn5Sp6PvVKfBwXMCIr3vJWfPyq yjXDhfkxuz4BRi5nBPwKhW1BWL9bChu+nZMy1MkPQe3lLOP3UtBCUf4wGq7k/CGeVdu6 FCcLFrQLJgTsONPgF5t709SHjmlrbKQuL7OBk9cKqz1rzeemuRIyfrU6xkVdMGG5Zubn k811ZMIu2jcT4ZyO6qxIhNflSeCR0eK8XN1ra4Sk269px2LWgJ/PTreZJimRGGKybZTn N4Z5+g9BL4639vfsjumQ0YhAKUKqnS0jZVT5rMUMyzaw9tpMBLuhq6jvlWB2/qJ/imRW i7lw==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@ventanamicro.com header.s=google header.b=djlGTVLT; arc=pass (i=1 spf=pass spfdomain=ventanamicro.com dkim=pass dkdomain=ventanamicro.com); spf=pass (google.com: domain of linux-kernel+bounces-145261-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:40f1:3f00::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-145261-linux.lists.archive=gmail.com@vger.kernel.org" Return-Path: Received: from sy.mirrors.kernel.org (sy.mirrors.kernel.org. [2604:1380:40f1:3f00::1]) by mx.google.com with ESMTPS id n2-20020a170902d2c200b001e3e23c2095si8277856plc.253.2024.04.15.06.53.56 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 15 Apr 2024 06:53:56 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel+bounces-145261-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:40f1:3f00::1 as permitted sender) client-ip=2604:1380:40f1:3f00::1; Authentication-Results: mx.google.com; dkim=pass header.i=@ventanamicro.com header.s=google header.b=djlGTVLT; arc=pass (i=1 spf=pass spfdomain=ventanamicro.com dkim=pass dkdomain=ventanamicro.com); spf=pass (google.com: domain of linux-kernel+bounces-145261-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:40f1:3f00::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-145261-linux.lists.archive=gmail.com@vger.kernel.org" Received: from smtp.subspace.kernel.org (wormhole.subspace.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by sy.mirrors.kernel.org (Postfix) with ESMTPS id 20843B23A65 for ; Mon, 15 Apr 2024 13:36:49 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id AA6F178685; Mon, 15 Apr 2024 13:23:41 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=ventanamicro.com header.i=@ventanamicro.com header.b="djlGTVLT" Received: from mail-ed1-f49.google.com (mail-ed1-f49.google.com [209.85.208.49]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 68EA07829B for ; Mon, 15 Apr 2024 13:23:39 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.208.49 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1713187420; cv=none; b=TQNs/ifd/DfXJPOWlbNjtifF2YhVUJtcsWa3XtOUUre2NzaTaStSKBjbx5zo/QyZ0dboS3hZh3fOBVsdeJTBWIcYbF8bNHyer3UFMP6r/qr9/e0/5NcwwL4K+zUYFgW04YjCf4WINL80SEv1XmuGns94BedOdzshtBE2vJ6wK0k= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1713187420; c=relaxed/simple; bh=6QDDaFd9eTHSjGZ+Gq69MqmItflrTqKnpwZ5H6nspls=; h=Date:From:To:Cc:Subject:Message-ID:References:MIME-Version: Content-Type:Content-Disposition:In-Reply-To; b=EnL+TFwrcUYsxQqN9zpORcLrV4bKRGRHoFUaxwW5aWat5KRpRXiMinpOOXWgwZ30aQAlrNBSHDDBeCvduP+baz4IXvIugxS1DFAAcDJPi0SZLbb7ufltgVxtN1qpUtJ6HjHbOwVoDqQ84yDD301jWmi978JH58UlFOZxjemS41w= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=ventanamicro.com; spf=pass smtp.mailfrom=ventanamicro.com; dkim=pass (2048-bit key) header.d=ventanamicro.com header.i=@ventanamicro.com header.b=djlGTVLT; arc=none smtp.client-ip=209.85.208.49 Authentication-Results: smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=ventanamicro.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=ventanamicro.com Received: by mail-ed1-f49.google.com with SMTP id 4fb4d7f45d1cf-56e2c1650d8so2968722a12.0 for ; Mon, 15 Apr 2024 06:23:39 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=ventanamicro.com; s=google; t=1713187418; x=1713792218; darn=vger.kernel.org; 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=SsPjsW5vGyGQYslNcZfnPrf8zdlh6X3WXkIuouRF3Dg=; b=djlGTVLTcajbVDmPo6YNTF2O+xyJkOimFpaRVQ7JuevkkNHFEadaaMCCaHNOsMhaIc MtJvD2+8UIpEGNK5EwrYO8VSYN5qAIu0D5b8QCiIdmfJxpI2PS71mI8JX/94vcQwIEVu pr34Qh84oOWtpnTBXr4/f9wdhj0DAEJsTvUtcNyc7sk5CltR/Fu+AvEYjOHQZhI/5sDO fc2w1Bq5RBdVP97WF9AbAWBmXyNrLGw6tUG43XxqhAbnIV9Hc+q0GHA4WmeX2eQOhvAi Nwo3ASmkh4LH9lmL5mFQOjAXlKJuaJBV8KeMFGDcRy9uvJg4qVAgRPAfuUstdrMFlyz4 0XLA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1713187418; x=1713792218; 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=SsPjsW5vGyGQYslNcZfnPrf8zdlh6X3WXkIuouRF3Dg=; b=KfTbiVTD3FfFDz3kQ5E+mCRXkey4DwX6u3CmLPsIyeBoIP3gQMpaMEl2GHrXMLXvXm FDMV4E3N85QqUt7aPxobHmoqeyfD08q5FGXRrFi+Gol9sDbudBRWZGbAHIDNMbF0PgYm Npf3ABw+dJAXOy/iWRtBrnfwFwCWkM1qSRBe7VUyML+S+gmUSmh7+JzQ0Xdml9LpKsEG 9hTymwK3ECkRraKMmaEVx05zQTKzWPGvADR1iqAefsF2GHJt86iGgmGvVbSMTFT88lKD Dj8XCX3CzbrVudJxfR477KSm5YuT4V51v3OiDGeeJRoLGbRzvwoHT+TDN4uhn81cDvXW oGjw== X-Gm-Message-State: AOJu0Yx2GNKKQqlZ0Bu1E1C8Dgh0OYsqc1Tpi9h2uHlCKKcxI2IBr3Oa 6C7Afn8aHVpEbkfD98Lm5ujQmwMQWR+pMgDYPoSM148yodUC+V3CwaCALIvHXSk= X-Received: by 2002:a17:906:f1c7:b0:a52:fb9:27ad with SMTP id gx7-20020a170906f1c700b00a520fb927admr6011866ejb.48.1713187416663; Mon, 15 Apr 2024 06:23:36 -0700 (PDT) Received: from localhost (cst2-173-16.cust.vodafone.cz. [31.30.173.16]) by smtp.gmail.com with ESMTPSA id ji16-20020a170907981000b00a5244a80cfcsm3480965ejc.91.2024.04.15.06.23.36 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 15 Apr 2024 06:23:36 -0700 (PDT) Date: Mon, 15 Apr 2024 15:23:35 +0200 From: Andrew Jones To: Atish Patra Cc: linux-kernel@vger.kernel.org, Anup Patel , Ajay Kaher , Albert Ou , Alexandre Ghiti , Alexey Makhalov , Atish Patra , Broadcom internal kernel review list , Conor Dooley , Juergen Gross , kvm-riscv@lists.infradead.org, kvm@vger.kernel.org, linux-kselftest@vger.kernel.org, linux-riscv@lists.infradead.org, Mark Rutland , Palmer Dabbelt , Paolo Bonzini , Paul Walmsley , Shuah Khan , virtualization@lists.linux.dev, Will Deacon , x86@kernel.org Subject: Re: [PATCH v6 14/24] RISC-V: KVM: Add perf sampling support for guests Message-ID: <20240415-cdc6d5bc6c5145f9d6f54afc@orel> References: <20240411000752.955910-1-atishp@rivosinc.com> <20240411000752.955910-15-atishp@rivosinc.com> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20240411000752.955910-15-atishp@rivosinc.com> On Wed, Apr 10, 2024 at 05:07:42PM -0700, Atish Patra wrote: > KVM enables perf for guest via counter virtualization. However, the > sampling can not be supported as there is no mechanism to enabled > trap/emulate scountovf in ISA yet. Rely on the SBI PMU snapshot > to provide the counter overflow data via the shared memory. > > In case of sampling event, the host first sets the guest's LCOFI > interrupt and injects to the guest via irq filtering mechanism defined > in AIA specification. Thus, ssaia must be enabled in the host in order > to use perf sampling in the guest. No other AIA dependency w.r.t kernel > is required. > > Reviewed-by: Anup Patel > Signed-off-by: Atish Patra > --- > arch/riscv/include/asm/csr.h | 3 +- > arch/riscv/include/asm/kvm_vcpu_pmu.h | 3 ++ > arch/riscv/include/uapi/asm/kvm.h | 1 + > arch/riscv/kvm/aia.c | 5 ++ > arch/riscv/kvm/vcpu.c | 15 ++++-- > arch/riscv/kvm/vcpu_onereg.c | 6 +++ > arch/riscv/kvm/vcpu_pmu.c | 68 +++++++++++++++++++++++++-- > 7 files changed, 93 insertions(+), 8 deletions(-) > Reviewed-by: Andrew Jones