From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id 5EF81C30653 for ; Wed, 26 Jun 2024 13:25:11 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender:List-Subscribe:List-Help :List-Post:List-Archive:List-Unsubscribe:List-Id:Content-Transfer-Encoding: Content-Type:In-Reply-To:From:References:Cc:To:Subject:MIME-Version:Date: Message-ID:Reply-To:Content-ID:Content-Description:Resent-Date:Resent-From: Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:List-Owner; bh=Wkp55ahjVZ0Rfp573fGCok3PgZ8FQzhwmhHHebz4g1I=; b=xa157al7S5s8kkqHT5F+6Y6i3r UiigHLuJAwUBq7WDH87//ywHkn33XgvMBKz8GnOZ8ErpDB+pR6vhtAdSwlQoafDuUQdeTny/Nak+F Q+hp6BgSAi0PPh7aAZvS29rgV3WOBt7Lqln/tNDVGURv3JoKLsPUdnam5fPQ9gfGLZsiKf6xfZR2x dyuSSy0TyUdjJnv1LUDWzE0DWY6Y9rZ649HHMPBKXwtARnHtbhxzTdUNqEVEg+jMnw6oXNohsuXvh Ybmm7ghq9FDZ4Nb5SKSo1Xn/eWXwZU/gOr0Ux3tisHHy3pUr7Grnuo6kOX+P3V3fBWDfCc5WlUEJk MF1m90Pw==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.97.1 #2 (Red Hat Linux)) id 1sMSds-00000006waO-0AwK; Wed, 26 Jun 2024 13:24:56 +0000 Received: from mail-oi1-x235.google.com ([2607:f8b0:4864:20::235]) by bombadil.infradead.org with esmtps (Exim 4.97.1 #2 (Red Hat Linux)) id 1sMSdh-00000006wW8-2Q8e for linux-arm-kernel@lists.infradead.org; Wed, 26 Jun 2024 13:24:48 +0000 Received: by mail-oi1-x235.google.com with SMTP id 5614622812f47-3d5616d7273so340994b6e.1 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=lists.infradead.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=aauX51/12WvFU4Cn+nGBYmYo3/CmvEpgohwuRBaOQiN+2bYY1mZEJZsbBPSkueh6Zj NbqSwLZpQlkd/SQj2WD5X/Q6i66MIYKdEv0OEe/ZqVt8JuKJ3X1cwbu56jzW72UDHZEB mlbltlDQQs0icBrIBY3bmd4ClUAX2wUDeEq568hi3i2yWaDattVLj6mBI3ayy/7xcAz+ fBUi2NBNkxhShxY66zJFlNkwBQcTD5kAgoxBzTbyWdQViLEzC9jysSHGi2/YI3Eqxd6w FuDmvjWNiStLSCrHSk6p9qbkyRyhC6AxXdtAGafbZs16hPmlkrMX5eI1LBe3CN1A/2vM VZ9A== 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=lVpCrbpnW3ARFC6/yv9b4DrOiqUl1a5dU5QnA+9fQBVLKBdY+naBHbzFOgeCqKr85O h5AQaPoxPnTF9XPwW313yCLcoO0qz7waJRUzKGwMhfYBjd7xIesJVK8HzmiZCOamRLQM yUlhxyA+Xi8+vdQBIRo5RKj0NfXYdOjMnTYN6EgzSambwqOV8yIHhp+3A8xkM3SXPv4V xkgEo5B5qHZvd/WovSJ5lgMM6XaMOh37hyKPiMKhlxMYUn2GFqLn2bPQCITEZMNt3JrJ dusg3OYs4jxEgXOsQi4nNlXehVGaBJzIAFKvJmoAR0x07hUL6ZryTv4TcVElBZoAQy7U mkkw== X-Forwarded-Encrypted: i=1; AJvYcCXULngw4cuZY5Hh3oaGUHRXlHKy7Sz8AcXBPd9VUrNBj8OnNF1CObzuxTFbiyeG8uHzKkr1Lqsa3PJxmCzaWfUTQBvh1S418UuRRxNPAn2sYYbKIwY= X-Gm-Message-State: AOJu0YyUllHhVnEKXyf+9KZSqNvv6b91M/o62p3Gk33umMHoEtPeOamG sKixC+o60bQ+cC4twYED5+6nJ2DbrD0NbuTaGPMnIawNIPetD0pVnnH5IC59Ets= 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 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 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20240626_062446_058152_8C81A4A3 X-CRM114-Status: GOOD ( 16.75 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org 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) >