Received: by 2002:a6b:500f:0:0:0:0:0 with SMTP id e15csp1021216iob; Fri, 13 May 2022 19:57:19 -0700 (PDT) X-Google-Smtp-Source: ABdhPJw4LNlf2lial3w3QTckyr0coTXZSy4lQMHrixw89122Y0+z79fpNQLrpoP9sJ5UUNlUq0Wv X-Received: by 2002:a1c:6a03:0:b0:395:ce4d:aeb1 with SMTP id f3-20020a1c6a03000000b00395ce4daeb1mr5860781wmc.88.1652497039346; Fri, 13 May 2022 19:57:19 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1652497039; cv=none; d=google.com; s=arc-20160816; b=ZpGZ+746VJn94sJH2FsNnQ/eVyOnjBpe8rqaNh9TKHcduFyGBfM0rdKZR0WekKiWJe FoYoIsuBIM3pTg877gIlF14+APzUd810X3u6aVkj8v7JNQLAsAWy2W93UdXFPoUOZAkq mEg97n4JiGDGJm5KCJXNBQr/gOtlu2MtOQtClSivgwy++cRpgqk6t2ZQ/So35GcMNOWz H2i7DfeYFJ5JeQWW7rtyvlEwWr73FcT5x4oW6Q6riB5mAhzon+jGVM1/E5Z5t3f/qkCG +Kgp6wacKVP7Nd8gLjuBpYLzAV7nvOSTg/+xwFUNqT3tTIx0nUHYb7/nl4ctUbcdVwcy HBTA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:cc:to:subject:message-id:date:from:in-reply-to :references:mime-version:dkim-signature; bh=oxm9sBcT1JV50HT4BCEDwPzwOlOzL6NEeugrpnzL0Jg=; b=Dr7HzcHEt9BCNhJnV9APjLu4tf9g2dGnh1k0NmijIJgddOUOuvXnntlFt+JAkBOfwE 3GG4UYhMuKyougPyJtpdLgfgqiRh5qwxfKq/YISenJwM6N+xVdJBfppHRCnb/aTZgjqB 9WpN+0yvaLCFT6HsbrzBxWHgUXD/I39+EoZ2rPWhysZl9B0KngX0VGuDxZXINy5a3xgA robaGhrw+P/2eqOZ+72cPYgow3QtiqoYTLS0pEdCuwiu6WdLt9anGmlDvyDGZnjEYCAG 1n8q1m4HN9Z3UvVCwDO2ypRAzLDElXdzN8QuaP7nEFMVY2/GEi4jHPQhu6DxJx3n2rHZ AagA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@brainfault-org.20210112.gappssmtp.com header.s=20210112 header.b=panjBDEr; spf=softfail (google.com: domain of transitioning linux-kernel-owner@vger.kernel.org does not designate 23.128.96.19 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from lindbergh.monkeyblade.net (lindbergh.monkeyblade.net. [23.128.96.19]) by mx.google.com with ESMTPS id o4-20020a5d6484000000b00207a9f639dbsi5121242wri.186.2022.05.13.19.57.18 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 13 May 2022 19:57:19 -0700 (PDT) Received-SPF: softfail (google.com: domain of transitioning linux-kernel-owner@vger.kernel.org does not designate 23.128.96.19 as permitted sender) client-ip=23.128.96.19; Authentication-Results: mx.google.com; dkim=pass header.i=@brainfault-org.20210112.gappssmtp.com header.s=20210112 header.b=panjBDEr; spf=softfail (google.com: domain of transitioning linux-kernel-owner@vger.kernel.org does not designate 23.128.96.19 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by lindbergh.monkeyblade.net (Postfix) with ESMTP id 0AD483925FD; Fri, 13 May 2022 16:42:05 -0700 (PDT) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1347842AbiELEof (ORCPT + 99 others); Thu, 12 May 2022 00:44:35 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:57720 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1347686AbiELEo3 (ORCPT ); Thu, 12 May 2022 00:44:29 -0400 Received: from mail-wr1-x42f.google.com (mail-wr1-x42f.google.com [IPv6:2a00:1450:4864:20::42f]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 1A5F32AE01 for ; Wed, 11 May 2022 21:44:26 -0700 (PDT) Received: by mail-wr1-x42f.google.com with SMTP id h16so4842591wrb.2 for ; Wed, 11 May 2022 21:44:26 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=brainfault-org.20210112.gappssmtp.com; s=20210112; h=mime-version:references:in-reply-to:from:date:message-id:subject:to :cc; bh=oxm9sBcT1JV50HT4BCEDwPzwOlOzL6NEeugrpnzL0Jg=; b=panjBDErMFFeS1mpF1owMJAimp+H0bnPlz5Y2undu+JiEi0GPmaur6O4CzEKXus9v5 Lw6Cqq1AX+NKjHUHxrSj6ibfkgpRNr9Ri/V4EWqF+kENnpoZCGkkphIgOPxwCL9ZHCTu fheb6cBnTch8v8xfGsOOxZrQKDn9XG5Kpi9J4rjbxJzuc0VnKVT/+zYJRJxOBYagb2mw /D9Lu9GITyoKqhvIzRsyqqLoDfJcIO9IUjmrsGNaT/3nMkXDsiRyPFYcSDkmxxTD5Osq mb3VFuEq6babUntnsclMHKP+QgSW/oHuit20EQTABbJI0zudfPflBr1yTSearkElGonP NFJA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc; bh=oxm9sBcT1JV50HT4BCEDwPzwOlOzL6NEeugrpnzL0Jg=; b=Rhuq7lC3TmSyhjqfCgD+kXqb80ZpRLrhah9SdJ41EJY1yOUAgVpCf1CuYK6o83nIkG kYVL5J1nucAKAiWK7O/OZEj4DhGPjrjPyOM7CtG+xT94Z1LT4tPDDXIq70nhVNdj3arE fsEes/3lq92xIf0a56NCfsc3MQyqM9yl4nxafZVltFuCChGBFetfvTm1/tgpa4oANRmZ jYJAWlrBbTA8cc6zjCde4DOfhScXV7Cvo9nNAEpYLYWV9VAR9GLA2qXpmLf+9bJ3pyn8 KboPknhMlxcQDcLnCcECH+QcoOAwGvzGm/h859k+1A3BC4bXKH5uR6pxjDiZjcNj/eJF sYcA== X-Gm-Message-State: AOAM533eozcKj32G/nCMQuJm/KwAfz9RRC+wizT53NnyyuHbBeTVehWJ Iz5WreybzNRbBWjyzxGFZYbyUIdDRxdMplg/hYwT3Q== X-Received: by 2002:a5d:6c6b:0:b0:1ea:77ea:dde8 with SMTP id r11-20020a5d6c6b000000b001ea77eadde8mr25588160wrz.690.1652330664582; Wed, 11 May 2022 21:44:24 -0700 (PDT) MIME-Version: 1.0 References: <20220511201107.2311757-1-atishp@rivosinc.com> In-Reply-To: <20220511201107.2311757-1-atishp@rivosinc.com> From: Anup Patel Date: Thu, 12 May 2022 10:14:12 +0530 Message-ID: Subject: Re: [PATCH 1/2] RISC-V: Fix counter restart during overflow for RV32 To: Atish Patra Cc: "linux-kernel@vger.kernel.org List" , Albert Ou , Atish Patra , Damien Le Moal , DTML , Jisheng Zhang , Krzysztof Kozlowski , linux-riscv , Palmer Dabbelt , Paul Walmsley , Rob Herring Content-Type: text/plain; charset="UTF-8" X-Spam-Status: No, score=-1.9 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI,RDNS_NONE, SPF_HELO_NONE,T_SCC_BODY_TEXT_LINE autolearn=no 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, May 12, 2022 at 1:41 AM Atish Patra wrote: > > Pass the upper half of the initial value of the counter correctly > for RV32. > > Fixes: 4905ec2fb7e6 ("RISC-V: Add sscofpmf extension support") > > 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 a1317a483512..24cea59612be 100644 > --- a/drivers/perf/riscv_pmu_sbi.c > +++ b/drivers/perf/riscv_pmu_sbi.c > @@ -526,7 +526,7 @@ static inline void pmu_sbi_start_overflow_mask(struct riscv_pmu *pmu, > max_period = riscv_pmu_ctr_get_width_mask(event); > init_val = local64_read(&hwc->prev_count) & max_period; > sbi_ecall(SBI_EXT_PMU, SBI_EXT_PMU_COUNTER_START, idx, 1, > - flag, init_val, 0, 0); > + flag, init_val, init_val >> 32, 0); This should be under "#if __riscv_xlen == 32". > } > ctr_ovf_mask = ctr_ovf_mask >> 1; > idx++; > -- > 2.25.1 > Apart from above, this looks good to me. Reviewed-by: Anup Patel Regards, Anup