Received: by 2002:ab2:1347:0:b0:1f4:ac9d:b246 with SMTP id g7csp235278lqg; Thu, 11 Apr 2024 00:40:26 -0700 (PDT) X-Forwarded-Encrypted: i=3; AJvYcCVyeb4xMTuvYpDbmFjcAddcF2ifQNc/qAEun8vY6ztkmm40WbDDt3vovHEwK1PFhCmgMWnNn3Xr7LhDr+hqOThnix8iD2emIDpJnMKCIA== X-Google-Smtp-Source: AGHT+IFQbQQWzYUmDwgQ08S6BKs+n1RFX4cwhta9haQsHfr5oYC1JodV9Pcq8zY4ejtE/WjlkX3W X-Received: by 2002:a05:622a:10e:b0:434:3e77:a34 with SMTP id u14-20020a05622a010e00b004343e770a34mr5023795qtw.25.1712821226709; Thu, 11 Apr 2024 00:40:26 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1712821226; cv=pass; d=google.com; s=arc-20160816; b=jLiDLehvhLVuR0YYLiIrTxOi/GzXaVC2+V7pWcquNo8LontJ8HqFPGdCaPd//Dkg2q FCegyZ6PE+YAMP2S3CpuNUl1cF/p2DP+R7efvyU3PmxSVPWBhgd3+Q+f08/4R05jr9q+ 8oB1wagzHh5zCuhRLDzw5huRA3YHG8083UMJ8sMrnZlQiwlUIACoa6kIj4RMNyxy+jwp 7/G3DZxI5jYj4LB+WjVIcrTs2kxPp6WfyqXYbCXCyZPV65bYHaIaReZ/tkTZrenG483U nYgfHJysCSQGq6byju8ajWkB/7XhzLVrqC5A/VZkO02qWHFJrD4TEYWpPMifrEUaQqDm kTdw== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=in-reply-to:content-transfer-encoding:content-disposition :mime-version:list-unsubscribe:list-subscribe:list-id:precedence :references:message-id:subject:cc:to:from:date:dkim-signature; bh=Qi1RHVmEtAvgNYlK/Z30HZoUwL3LvYqcc/16dHeni2I=; fh=DZ+90IYKX6348qhaU1RCU+Dr99/fUPfwupWVjDQaDdA=; b=KU6JWFZXd+yr6zVDkxRgQnS08zcOFlhxbJOvSAVU3daJ0lYp2q/UwmCemMFGdMatUc iSApXOXTmqBrwUXUE5cl80m/cFiy2ihvE3M11Sg4ADjDk3QfAXRBPhtmgiSSRaqnT4bD dlUUpcxKGJfDYBLg2n1+3N4yUlfcbj4vJ2e0Ws2zOEfSTObMQiBP1bGcQm3smhlbPMGA Qgtjx9ymp2OOCGTyT5Bfhl3NXaBE3A9lULT7J6p0rG+AUmKilhhwSVNx+8Dx3LLZPl6S 2ybP8W2egZWbsOjk5HzNBmrb7yO8t8NPsWqRCffDlUJ1EEmmnMoZbxD6q5LhzKdRr7Q9 GBLg==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@ventanamicro.com header.s=google header.b=PyXZMQnv; arc=pass (i=1 spf=pass spfdomain=ventanamicro.com dkim=pass dkdomain=ventanamicro.com); spf=pass (google.com: domain of linux-kernel+bounces-139999-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45d1:ec00::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-139999-linux.lists.archive=gmail.com@vger.kernel.org" Return-Path: Received: from ny.mirrors.kernel.org (ny.mirrors.kernel.org. [2604:1380:45d1:ec00::1]) by mx.google.com with ESMTPS id y7-20020a05622a120700b004364fb2f1adsi939671qtx.233.2024.04.11.00.40.26 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 11 Apr 2024 00:40:26 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel+bounces-139999-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45d1:ec00::1 as permitted sender) client-ip=2604:1380:45d1:ec00::1; Authentication-Results: mx.google.com; dkim=pass header.i=@ventanamicro.com header.s=google header.b=PyXZMQnv; arc=pass (i=1 spf=pass spfdomain=ventanamicro.com dkim=pass dkdomain=ventanamicro.com); spf=pass (google.com: domain of linux-kernel+bounces-139999-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45d1:ec00::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-139999-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 ny.mirrors.kernel.org (Postfix) with ESMTPS id 610311C20AAC for ; Thu, 11 Apr 2024 07:40:26 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 07C3813E8AF; Thu, 11 Apr 2024 07:38:47 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=ventanamicro.com header.i=@ventanamicro.com header.b="PyXZMQnv" Received: from mail-ej1-f49.google.com (mail-ej1-f49.google.com [209.85.218.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 54A3913E05F for ; Thu, 11 Apr 2024 07:38:44 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.218.49 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1712821126; cv=none; b=dRz2bP7ECOGO8qWKPEiwQSsTACu8shutPJVl3X6gR4zi0Fo9TOqlfeRPO3nckspGWgpz/AKRKsCIJ2PMhpV4fcruZFB1WALlfHrCjNTLKKhwEQ5YE5mcXs46utuINCZIJW3JoKMEtaH2izmpaZNQk0m8sCUEvu+1VgON9WUij8Q= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1712821126; c=relaxed/simple; bh=1vkXgr7mU8ODetSlTUd524GtmWxMzUtCT+xXdKXnC+Q=; h=Date:From:To:Cc:Subject:Message-ID:References:MIME-Version: Content-Type:Content-Disposition:In-Reply-To; b=c2lrlw2xcNoVFnx69oJ2GvzSxOLgEydL2mfHP8i6/7C/JgamqYEhGa7nK+6L2YNGqfX/utrPz+HOkDuKKux6hFg2lGJlnRAZil/huBf9WC8NJlNgWHsho2TDYONu+bcTO3TomBJVBVMcp6QQa/iNAnXMkA5gJQv6DDEid24Pi+8= 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=PyXZMQnv; arc=none smtp.client-ip=209.85.218.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-ej1-f49.google.com with SMTP id a640c23a62f3a-a5224dfa9adso28264066b.0 for ; Thu, 11 Apr 2024 00:38:44 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=ventanamicro.com; s=google; t=1712821122; x=1713425922; darn=vger.kernel.org; h=in-reply-to:content-transfer-encoding:content-disposition :mime-version:references:message-id:subject:cc:to:from:date:from:to :cc:subject:date:message-id:reply-to; bh=Qi1RHVmEtAvgNYlK/Z30HZoUwL3LvYqcc/16dHeni2I=; b=PyXZMQnv7q/B4067/6mgaOEdkORETeuEB3mvFDQ4A0rKtG2pvW2uRyba18ydAUoWmM 6AUgOfSAYS1UorUFUhBo88UfWUOA2xPYmi84UgPQMJxKYo/pykINfEuKLiyx4crR14fq nUsk5eUgBVGU0QsugfbOyQ/WLxwRXxSQ9R6LbXqY8vRueJpePn4WFi9FK1G/VbwYZ/kC VL5z1uE86679A0/BxlJIegJiLKMFt9oiA/SVNS3bdtfbrdfDdzdiKJuwgVPqcp8gdLDY 6S5qVnuyXtGd5ztBBL+ddfBQJmMQDmN1rYIlemg1I41JRAWPSP33boe+WKqaXHAPp5Xm rEyw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1712821122; x=1713425922; h=in-reply-to:content-transfer-encoding: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=Qi1RHVmEtAvgNYlK/Z30HZoUwL3LvYqcc/16dHeni2I=; b=gOCZsPWHjOIBBx9EO1W2XSuR9w9aojLIr2tHOunyzgofMQfbQSR55mQ70gSzhQFs2a Vkvaq9SuQJuoOyRzl3AsH/57IpMNf+s1Wz9QCaeMJ8CjJjv2X0aJNIzUjvJgETbetS9S v7aw/qQOTRubUee771/f9pMl2IwMMhr5Xv4yNA2pivIfYZXsCeyirT/7ExUr7ATXVG8M 6+uAcZHdgKqQNIuTVF1Ti8lCaagDNik7auQ6EP2cVXEJbBRtOLsdlWc6xMP61ScxtUbB 7ck+XHX+oZfEQxgqJrmByIOGSHndoPhyqDCqk/96VbFz7iY6bOmP9ygpm0xjm81Aw/SH o5Og== X-Forwarded-Encrypted: i=1; AJvYcCVGYJnZVrB+BGCRGpLmxRVFvTHRDEmA87EXy+ksA3wr3LBjvu2142N+8w3DpJPMhOtpMYwG7Q2C3Gc4h9KMhVvnFdWQSh20udzjRcI2 X-Gm-Message-State: AOJu0Yx2Zvx8Re/Liq6nPWpyxhQ1gDYCG2s6CtUwYx0qrOCXX9bOj1f7 Pvrc6mRlgMdu3sm+PjzFc/BTrfnlr+gRVPhF3pm+O/uvwY+ONziPZSlVdSaMnkaDHqvMWhDNGah R X-Received: by 2002:a17:907:1c2a:b0:a4e:410e:9525 with SMTP id nc42-20020a1709071c2a00b00a4e410e9525mr1764454ejc.30.1712821122486; Thu, 11 Apr 2024 00:38:42 -0700 (PDT) Received: from localhost (cst2-173-16.cust.vodafone.cz. [31.30.173.16]) by smtp.gmail.com with ESMTPSA id gv7-20020a170906f10700b00a4e0df9e793sm478233ejb.136.2024.04.11.00.38.41 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 11 Apr 2024 00:38:42 -0700 (PDT) Date: Thu, 11 Apr 2024 09:38:41 +0200 From: Andrew Jones To: Atish Patra Cc: Atish Patra , linux-kernel@vger.kernel.org, Anup Patel , Albert Ou , Alexandre Ghiti , Conor Dooley , Guo Ren , Icenowy Zheng , 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 , Will Deacon Subject: Re: [PATCH v4 07/15] RISC-V: KVM: No need to exit to the user space if perf event failed Message-ID: <20240411-6fe47ccc32d9cb7baa121b4d@orel> References: <20240229010130.1380926-1-atishp@rivosinc.com> <20240229010130.1380926-8-atishp@rivosinc.com> <20240302-1a3c0df25f2422e1e6abecf3@orel> <20240404-ea40bc0237635d671e64fef6@orel> <7d02c86e-8c36-4e78-9fa8-5e30f3431eb3@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=utf-8 Content-Disposition: inline Content-Transfer-Encoding: 8bit In-Reply-To: <7d02c86e-8c36-4e78-9fa8-5e30f3431eb3@rivosinc.com> On Wed, Apr 10, 2024 at 03:44:32PM -0700, Atish Patra wrote: > On 4/4/24 05:16, Andrew Jones wrote: > > On Mon, Apr 01, 2024 at 03:37:01PM -0700, Atish Patra wrote: > > > On Sat, Mar 2, 2024 at 12:16 AM Andrew Jones wrote: > > > > > > > > On Wed, Feb 28, 2024 at 05:01:22PM -0800, Atish Patra wrote: > > > > > Currently, we return a linux error code if creating a perf event failed > > > > > in kvm. That shouldn't be necessary as guest can continue to operate > > > > > without perf profiling or profiling with firmware counters. > > > > > > > > > > Return appropriate SBI error code to indicate that PMU configuration > > > > > failed. An error message in kvm already describes the reason for failure. > > > > > > > > I don't know enough about the perf subsystem to know if there may be > > > > a concern that resources are temporarily unavailable. If so, then this > > > > > > Do you mean the hardware resources unavailable because the host is using it ? > > > > Yes (I think). The issue I'm thinking of is if kvm_pmu_create_perf_event > > (perf_event_create_kernel_counter) returns something like EBUSY and then > > we translate that to SBI_ERR_NOT_SUPPORTED. I'm not sure guests would > > interpret not-supported as an error which means they can retry. Or if > > they retry and get something other than not-supported if they'd be > > confused. > > > > At least in Linux driver, treats -ENOTSUPP and it just fails. Other guest OS > implementation may interpret it differently. But they should fail at that > point as well. I don't see how can they interpret to be retry. > > The perf user can retry again with assumption that may be enough counters > are not available at this moment. But that's different from return a retry > from driver code. > > Even if we support a retry error code, when does the caller retry it ? > The driver doesn't know how long the user is going to run the perf command > to keep the hardware resources occupied. > > I feel the perf user is the best entity to know that and should retry if it > knows the previous run is over which might have released the hardware > resources. I agree, but how does the user know that retrying makes sense? I presume -ENOTSUPP will get propagated all the way to the user in a form that means "not supported". Or, can the user list all resources and then when they see "not supported" know that means "not supported at the moment", as they've already seen that the resources exist? Anyway, as I said, I don't know enough about the perf subsystem to know if this is a real concern or not, but it sort of looks like we have potential to tell users that something isn't supported when in fact it is supported, but only temporarily unavailable. Thanks, drew