Received: by 2002:a6b:500f:0:0:0:0:0 with SMTP id e15csp685137iob; Thu, 12 May 2022 02:25:40 -0700 (PDT) X-Google-Smtp-Source: ABdhPJzEvxqK3MAXKhusRtYriRJMTFBdlpR68EktDYj2ammYhRdCyPrzD64zNurykRilKyH+cI1f X-Received: by 2002:a17:906:3101:b0:6d6:5b64:906f with SMTP id 1-20020a170906310100b006d65b64906fmr28940787ejx.513.1652347540412; Thu, 12 May 2022 02:25:40 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1652347540; cv=none; d=google.com; s=arc-20160816; b=fqUGrx+6CXg0Ncd3qvPyjLOXiXuwql869AT8aDTRWfIeTf1R3km9a55++ssVfWeI3A 1X+fRlQXHTMR5M1dlBPx4ZKCm5Ov1tIZWj6CAw2ryJtAZ2eAVwcB0MhKPrII8HvSLJiy GsAYOg+qIdvD7FWheKT0YA+HODOoLekqRMHN7C0Gtsf5r1x1F0caYEvPzu8nq69H9tL1 wUrQMqH4f129Bx8ReJaTAeYIbh7FvE0leNdwTHaEm1RNwg97sVTv241jnyXnNQk/Imbp ZncpNteltOSAUT/29pg8/ADS7WGZK0lhThfpqjJedMT2NVUjCBiT7CgnEA1yLGzP1ObN 3Esg== 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=nB/czAIXlJJ8PHEUqcnrNljzAJJcfTV3UmWzXVmd/Cs=; b=p5+wOKMLGn8BetDkHWtsfnPKqwYep9Fm+PsPlJDRKuJv0iwqCV+pgCV8YWxjFvoam7 z2cNJ2mr0L7EEzi+SqI+royPGXu02uNsfSErTlQ7Hh56KWRhykHtySJdTH0DLaIxL5Bn pUWQ5CksnsCaMb6XwL3pQLt8PuwVZBJIeYr9+IW6+N3RXhQEyWkIfC3c60uI7am+QlAE NcnTYKejTKpB807mSb6BlUgLkLU/p6nQ0B8m1GoGq0oNpM8Qm7uOUZ/jFqDyXaVNsWZT 9uPhCXypIULJUaydDKutIH13gyelj0zsVC9YKGhy6mfCJQ4+dnm1zgUmryQeJl+h7a5h o5iA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@brainfault-org.20210112.gappssmtp.com header.s=20210112 header.b=uJorObYa; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id ne27-20020a1709077b9b00b006f4489cfba4si6625305ejc.735.2022.05.12.02.25.13; Thu, 12 May 2022 02:25:40 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@brainfault-org.20210112.gappssmtp.com header.s=20210112 header.b=uJorObYa; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1348013AbiELEp3 (ORCPT + 99 others); Thu, 12 May 2022 00:45:29 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:58540 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1347991AbiELEpX (ORCPT ); Thu, 12 May 2022 00:45:23 -0400 Received: from mail-wr1-x431.google.com (mail-wr1-x431.google.com [IPv6:2a00:1450:4864:20::431]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id D9785219F55 for ; Wed, 11 May 2022 21:45:19 -0700 (PDT) Received: by mail-wr1-x431.google.com with SMTP id j25so4516053wrc.9 for ; Wed, 11 May 2022 21:45:19 -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=nB/czAIXlJJ8PHEUqcnrNljzAJJcfTV3UmWzXVmd/Cs=; b=uJorObYandt+4O05YsIkNx5pXRqDbRHU94W6N1cx4h7FkzmjxjYu6zQ7JOC2IoqZ3I K+NokQmLZvZEsSnrPI32VjBpodTdZ4CVMuSZQMDyvwiY3KvOVa6bsn1EiKPQXY+xbHx2 3ujNWKnT/cicNYkm+ZB8mDvF5YLtei+WOgqMXS6Ste14Qpp4j8w/owZUfdtOqs1ZBq32 AVrGkmulAwPqQs3SbZ8RJVXmPovBQMWMOLfo//EsVyhqI6OKdY/vHSOrvkKQyHfJ1T1a w/gaDWYAPXbqyKh4vrhpDUkT+LXZABfi3lv1aGyO1dmftPUcvF+C2R5tp81bm2HlF/VH YRuA== 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=nB/czAIXlJJ8PHEUqcnrNljzAJJcfTV3UmWzXVmd/Cs=; b=pYWw5ZyJhVrDr4Xgie1l1cfGWMsKZtRT0ReglE5JXOM7rlIY8RTechMAvOyhRsWSUW rP8SW6GOdM5NJ/jHMNmGqLXur2e9PpE2aGJUPpJinEoEWFcnKkrgV6hytqeVDeobkmBS nqtLjBJ3sU6Vdun/N1puZ7XRuRFJSUMTk1WJ4hlEL02iBKrlN/ZWS5Yf2aQfyK+3f7KL 4lFpUqwW7yZ8fcn/HjX/F62IvCaS14pmc1MUXAUHZv+42s1xp5xOKg0Phlws2gy2j7yz LNN8CZ+376kpnOuj/BpsqUuihlD95cgJCtjyab5PeyMrAtgAUfi9zxjacMCHyeavDMQ/ WSMg== X-Gm-Message-State: AOAM531av7P1u5z6ou9Sa8t3Bhcme2OlVfHEtBe7/ROCTubBbPPPD07Y xGmCBcDQcU/CsZ/hgnvdD9HotqM9LQeADCGCWFsLZQ== X-Received: by 2002:a5d:6483:0:b0:20c:5c21:5c8c with SMTP id o3-20020a5d6483000000b0020c5c215c8cmr25640208wri.86.1652330717991; Wed, 11 May 2022 21:45:17 -0700 (PDT) MIME-Version: 1.0 References: <20220511201107.2311757-1-atishp@rivosinc.com> <20220511201107.2311757-2-atishp@rivosinc.com> In-Reply-To: <20220511201107.2311757-2-atishp@rivosinc.com> From: Anup Patel Date: Thu, 12 May 2022 10:15:06 +0530 Message-ID: Subject: Re: [PATCH 2/2] RISC-V: Update user page mapping only once during start 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,RCVD_IN_DNSWL_NONE,SPF_HELO_NONE,SPF_NONE, T_SCC_BODY_TEXT_LINE autolearn=ham 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: > > Currently, riscv_pmu_event_set_period updates the userpage mapping. > However, the caller of riscv_pmu_event_set_period should update > the userpage mapping because the counter can not be updated/started > from set_period function in counter overflow path. > > Invoke the perf_event_update_userpage at the caller so that it > doesn't get invoked twice during counter start path. > > Fixes: f5bfa23f576f ("RISC-V: Add a perf core library for pmu drivers") > > Signed-off-by: Atish Patra Looks good to me. Reviewed-by: Anup Patel Regards, Anup > --- > drivers/perf/riscv_pmu.c | 1 - > drivers/perf/riscv_pmu_sbi.c | 1 + > 2 files changed, 1 insertion(+), 1 deletion(-) > > diff --git a/drivers/perf/riscv_pmu.c b/drivers/perf/riscv_pmu.c > index b2b8d2074ed0..130b9f1a40e0 100644 > --- a/drivers/perf/riscv_pmu.c > +++ b/drivers/perf/riscv_pmu.c > @@ -170,7 +170,6 @@ int riscv_pmu_event_set_period(struct perf_event *event) > left = (max_period >> 1); > > local64_set(&hwc->prev_count, (u64)-left); > - perf_event_update_userpage(event); > > return overflow; > } > diff --git a/drivers/perf/riscv_pmu_sbi.c b/drivers/perf/riscv_pmu_sbi.c > index 24cea59612be..2eac5db2cc18 100644 > --- a/drivers/perf/riscv_pmu_sbi.c > +++ b/drivers/perf/riscv_pmu_sbi.c > @@ -527,6 +527,7 @@ static inline void pmu_sbi_start_overflow_mask(struct riscv_pmu *pmu, > init_val = local64_read(&hwc->prev_count) & max_period; > sbi_ecall(SBI_EXT_PMU, SBI_EXT_PMU_COUNTER_START, idx, 1, > flag, init_val, init_val >> 32, 0); > + perf_event_update_userpage(event); > } > ctr_ovf_mask = ctr_ovf_mask >> 1; > idx++; > -- > 2.25.1 >