From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mail-oi1-f178.google.com (mail-oi1-f178.google.com [209.85.167.178]) (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 5188A181BB8 for ; Wed, 26 Jun 2024 13:24:44 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.167.178 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1719408287; cv=none; b=BumAMuA03P7iRoErYPTRpEeFyhM7jkfzsWgv1oGHQVeAGWdE+5cHaJ6KdiMgGUMZIWXZTi+b+Xfvv4hREkKSN6LtwCmKPIb53zXM/ZIHDfmiouBNWWuIWGl1G0yphnm/IuZZjY5dIvxkdQTb4rI8o/ZEu7eWXlO2YODhWR1u318= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1719408287; c=relaxed/simple; bh=0gdryHBCLxjbkn2nn9kVoQ75BunZ6TaLK7IoY+AEzJ8=; h=Message-ID:Date:MIME-Version:Subject:To:Cc:References:From: In-Reply-To:Content-Type; b=SY5Yu9srIhGQ4f5APSENSwelPesKt0N4JvPOXnjwW/iDabGhT4RWIiMQLEZctTqMBy8RyxAGPPZmwtxmFLoO9TFwd6M+D6wCc+cJ6AwDR1IoyHaAAsdShToXTOSpY5NtNNoxH33lKjUddWmltRK/Ps69JmNUxZvZPyLap4J0030= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=sifive.com; spf=pass smtp.mailfrom=sifive.com; dkim=pass (2048-bit key) header.d=sifive.com header.i=@sifive.com header.b=ZP9aKADi; arc=none smtp.client-ip=209.85.167.178 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=sifive.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=sifive.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=sifive.com header.i=@sifive.com header.b="ZP9aKADi" Received: by mail-oi1-f178.google.com with SMTP id 5614622812f47-3c9cc681ee4so3475554b6e.0 for ; Wed, 26 Jun 2024 06:24:44 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=sifive.com; s=google; t=1719408283; x=1720013083; darn=vger.kernel.org; h=content-transfer-encoding:in-reply-to:from:content-language :references:cc:to:subject:user-agent:mime-version:date:message-id :from:to:cc:subject:date:message-id:reply-to; bh=Wkp55ahjVZ0Rfp573fGCok3PgZ8FQzhwmhHHebz4g1I=; b=ZP9aKADioZThtluG5R6R6SBUdoG84x+ycRWK1vh8HPzLhHiTSmL5Yup12rqKJFx2P5 e4Cs36G80h4RNKSKUU6sIi1mwHV7HQ9OY7jTGwXtkwHvb3JM1VbWLG2QTcPeDwzwuMe7 fdTv5IWG/d3hsSCxIQyEtNVIbPu/JtmEP7XKYqW3PDRNNRlyDfmTnLejNmmZb3RHvPY0 gefO2iuBf8OOod9vMvSLvrMBSMdDdMLwKdkyXHsn5zfVuKt/eX6wUaDlfdesAiWZC3jx dwWDCGJ4XfuRdytRTcnucHMs0nbASOaqpKMpMSl9jXrzNv6kQv737WVFF9/FemOWvP9E PBSA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1719408283; x=1720013083; h=content-transfer-encoding:in-reply-to:from:content-language :references:cc:to:subject:user-agent:mime-version:date:message-id :x-gm-message-state:from:to:cc:subject:date:message-id:reply-to; bh=Wkp55ahjVZ0Rfp573fGCok3PgZ8FQzhwmhHHebz4g1I=; b=siYVzW5RVzwlieObpM9WaylhGLOSKkRErAtg8Sl97SDBdY5mW2LWTwcYvHDlrLvQnX ozhxsiwtz+ToJL49cGOKzUEfc7a2VZxcP2SKrAkR/mWleG4sK4BnX4SA8MGqFMW6vjc3 z9Rz1LvCHxUpPJkH+RRWmXh0k1n0pE6sm1zdOVEDg6ZHLiUqBDf1Hcux9jYcCH6fS4E/ tW0lYH65LFLtlxTixwWaL5jZkMjQj7OglEv+8kn+q/9PxG2F7kAIXz+kd+RSp4Vd+Iwm Zqdo9I2Vx9HlL/Yo/yEgpvUBQCdkekPOGdbcyJ/is7jeMzYiJxV2PIsko1GKi1omkWWu Z4qA== X-Forwarded-Encrypted: i=1; AJvYcCVJJ5Gd1oOXjiZ8AL0KUxbxgkpBjegHacfDhdOkYXHoLM6tv80DamoGuh4O5xPCHeYzCzzlRanmYQHPTMSExkeZj1lySQnJ4EINdqz7 X-Gm-Message-State: AOJu0YxWxTL9NCiJRyRbhQ4SwydNgW1KQTN65eCk8cojrF+reVb3e9AI vCjKzWiQaGBFvdqtW+pQqkdIbebFq9hvJ7BFE9jKawWpKvbjgmb3uD22Z2Fn7g8= X-Google-Smtp-Source: AGHT+IGjUEEcz36KEcz+5nyRJUX3HiZuhEGJ4dUtFILeDTtVRJBPYTVudg8HhkaZzHTox5uiPEmTvA== X-Received: by 2002:a05:6808:f87:b0:3d2:83:341c with SMTP id 5614622812f47-3d545a89b08mr12556384b6e.51.1719408283452; Wed, 26 Jun 2024 06:24:43 -0700 (PDT) Received: from [100.64.0.1] ([147.124.94.167]) by smtp.gmail.com with ESMTPSA id 5614622812f47-3d5344086c5sm2320908b6e.0.2024.06.26.06.24.40 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Wed, 26 Jun 2024 06:24:42 -0700 (PDT) Message-ID: <96ff4dd2-db66-4653-80e9-97d4f1381581@sifive.com> Date: Wed, 26 Jun 2024 08:24:38 -0500 Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 User-Agent: Mozilla Thunderbird Subject: Re: [PATCH v3 2/3] drivers/perf: riscv: Reset the counter to hpmevent mapping while starting cpus To: Atish Patra , linux-riscv@lists.infradead.org, kvm-riscv@lists.infradead.org Cc: Atish Patra , Anup Patel , Will Deacon , Mark Rutland , Paul Walmsley , Palmer Dabbelt , Andrew Jones , Conor Dooley , Palmer Dabbelt , Alexandre Ghiti , linux-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org, kvm@vger.kernel.org References: <20240626-misc_perf_fixes-v3-0-de3f8ed88dab@rivosinc.com> <20240626-misc_perf_fixes-v3-2-de3f8ed88dab@rivosinc.com> Content-Language: en-US From: Samuel Holland In-Reply-To: <20240626-misc_perf_fixes-v3-2-de3f8ed88dab@rivosinc.com> Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 7bit On 2024-06-26 2:23 AM, Atish Patra wrote: > From: Samuel Holland > > Currently, we stop all the counters while a new cpu is brought online. > However, the hpmevent to counter mappings are not reset. The firmware may > have some stale encoding in their mapping structure which may lead to > undesirable results. We have not encountered such scenario though. > This needs: Signed-off-by: Samuel Holland otherwise your commit message looks fine to me. > Signed-off-by: Atish Patra > --- > drivers/perf/riscv_pmu_sbi.c | 2 +- > 1 file changed, 1 insertion(+), 1 deletion(-) > > diff --git a/drivers/perf/riscv_pmu_sbi.c b/drivers/perf/riscv_pmu_sbi.c > index a2e4005e1fd0..94bc369a3454 100644 > --- a/drivers/perf/riscv_pmu_sbi.c > +++ b/drivers/perf/riscv_pmu_sbi.c > @@ -762,7 +762,7 @@ static inline void pmu_sbi_stop_all(struct riscv_pmu *pmu) > * which may include counters that are not enabled yet. > */ > sbi_ecall(SBI_EXT_PMU, SBI_EXT_PMU_COUNTER_STOP, > - 0, pmu->cmask, 0, 0, 0, 0); > + 0, pmu->cmask, SBI_PMU_STOP_FLAG_RESET, 0, 0, 0); > } > > static inline void pmu_sbi_stop_hw_ctrs(struct riscv_pmu *pmu) >