Received: by 2002:a05:6358:7058:b0:131:369:b2a3 with SMTP id 24csp7331552rwp; Tue, 18 Jul 2023 13:42:29 -0700 (PDT) X-Google-Smtp-Source: APBJJlFnf6XNi7Ty8E3wotJ/E3dhxr5V9etAblY/1s2+6KasPtLarJBh3oJ4tuH/UmyWQJnZ2p3S X-Received: by 2002:a17:903:230b:b0:1b8:b0c4:2e3d with SMTP id d11-20020a170903230b00b001b8b0c42e3dmr12844364plh.4.1689712948834; Tue, 18 Jul 2023 13:42:28 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1689712948; cv=none; d=google.com; s=arc-20160816; b=Tx04oi9XuCTAXqcv1K9kDJFv43biEiXbu+XbOL7Yf9X+PC4Q9HNpnT6mA4B8Cs+3LA Zz7bc/QRn/YFH3EJpU+6mDyu+EJ7s3/vyMsBUpgFsKVXwKIwINkkBqtiaoNptMI2fHLl El/fywq+Yc7x1WKzEy2/W+ToCnPmcXPbCT4wGx8MukPTzvyvpo+39JD1OPnw82ip05Us SAvpvTr7/0P0oiW0UKOSK+qwJ7jaHm+/1LxJyU2ocicmx/D5DvsQ1ogDl6W0UiiTNCyE 5rkTD4fWj5qeHTpPRYIn2tniirdNMjonDmqWfQ2/c4wEhewxoLMQBRkxKS4t3lvJXZU2 DS2g== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :references:in-reply-to:organization:message-id:date:subject:cc:to :from; bh=ArK/uyo96y1VZQNNIXSvEpZsM/dR+3Ks25u400r6STU=; fh=wp15ZNyxPvNMjcP33Y2pwiJZM1kLFa18TWPcx/EaFgI=; b=podQ6Jw5Jf3vN35cftEDvctocZL0srPF/m9U+DHYkuqKYu5/BJOKhQr+wnIMeLleUb SqcKVvQ8/uHsBMGg6za4i72cvpy18f03UtG4pmap/bTNsVbDfXYF3S24oO33tqBHn2RL 9xHcsJC2aOCr+UrDdItPt/MpNYhGQ3DvLHcU5Mrqj/ZInXKN88jOtrfXPwlkpMRG4FLU tLaiIgQiHHYQ20o+jUgrMV3xAiYZ8PUPGNHWubRYJXSrGns50MIG2rbCqEyJwqGu+JxO Ke5BSURlcBIc2SUsgtVAEb2HJOuomBzf/nSSykTf1dLihVW9LNvkgihZPbLHID71rFYh oyMA== ARC-Authentication-Results: i=1; mx.google.com; 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 n13-20020a170903110d00b001b52e5751c8si2165646plh.102.2023.07.18.13.42.15; Tue, 18 Jul 2023 13:42:28 -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; 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 S229756AbjGRUUo convert rfc822-to-8bit (ORCPT + 99 others); Tue, 18 Jul 2023 16:20:44 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:41778 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229479AbjGRUUm (ORCPT ); Tue, 18 Jul 2023 16:20:42 -0400 X-Greylist: delayed 4552 seconds by postgrey-1.37 at lindbergh.monkeyblade.net; Tue, 18 Jul 2023 13:20:41 PDT Received: from 14.mo581.mail-out.ovh.net (14.mo581.mail-out.ovh.net [178.33.251.19]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 35749B6 for ; Tue, 18 Jul 2023 13:20:41 -0700 (PDT) Received: from director4.ghost.mail-out.ovh.net (unknown [10.109.156.164]) by mo581.mail-out.ovh.net (Postfix) with ESMTP id 2E98D26CC6 for ; Tue, 18 Jul 2023 19:04:47 +0000 (UTC) Received: from ghost-submission-6684bf9d7b-g6sfr (unknown [10.110.103.4]) by director4.ghost.mail-out.ovh.net (Postfix) with ESMTPS id 5EA4F1FDBD; Tue, 18 Jul 2023 19:04:46 +0000 (UTC) Received: from courmont.net ([37.59.142.109]) by ghost-submission-6684bf9d7b-g6sfr with ESMTPSA id hDu6EU7itmQ5AgAA6V/YAg (envelope-from ); Tue, 18 Jul 2023 19:04:46 +0000 Authentication-Results: garm.ovh; auth=pass (GARM-109S003d480a6fd-102e-4f80-8590-9c2f09ff353c, 3111FEB0E50A85C15A7B3C8E702AC4BF574C28F6) smtp.auth=postmaster@courmont.net X-OVh-ClientIp: 87.92.194.88 From: =?ISO-8859-1?Q?R=E9mi?= Denis-Courmont To: Atish Patra Cc: linux-riscv@lists.infradead.org, linux-kernel@vger.kernel.org, Aurelien Jarno , Mathieu Malaterre , Jan Newger Subject: Re: [PATCH v4 00/10] riscv: Allow userspace to directly access perf counters Date: Tue, 18 Jul 2023 22:04:45 +0300 Message-ID: <8756384.Zvl9fuB8X0@basile.remlab.net> Organization: Remlab In-Reply-To: References: <20230703124647.215952-1-alexghiti@rivosinc.com> <4761144.fSbbhVQpq0@basile.remlab.net> MIME-Version: 1.0 Content-Transfer-Encoding: 8BIT Content-Type: text/plain; charset="UTF-8" X-Ovh-Tracer-Id: 16307252779307833786 X-VR-SPAMSTATE: OK X-VR-SPAMSCORE: -100 X-VR-SPAMCAUSE: gggruggvucftvghtrhhoucdtuddrgedviedrgeeggdduvdelucetufdoteggodetrfdotffvucfrrhhofhhilhgvmecuqfggjfdpvefjgfevmfevgfenuceurghilhhouhhtmecuhedttdenucesvcftvggtihhpihgvnhhtshculddquddttddmnecujfgurhephffvvefufffkohgjfhgggfgtsehtqhertddttdejnecuhfhrohhmpeftrohmihcuffgvnhhishdqvehouhhrmhhonhhtuceorhgvmhhisehrvghmlhgrsgdrnhgvtheqnecuggftrfgrthhtvghrnhephedujedulefftedvvefgueehjeekhfeukeegtdeijefgheevgeehkeekhedtleeknecuffhomhgrihhnpehffhhmphgvghdrohhrghdprhgvmhhlrggsrdhnvghtnecukfhppeduvdejrddtrddtrddupdekjedrledvrdduleegrdekkedpfeejrdehledrudegvddruddtleenucevlhhushhtvghrufhiiigvpedtnecurfgrrhgrmhepihhnvghtpeduvdejrddtrddtrddupdhmrghilhhfrhhomhepoehrvghmihesrhgvmhhlrggsrdhnvghtqedpnhgspghrtghpthhtohepuddprhgtphhtthhopehlihhnuhigqdhkvghrnhgvlhesvhhgvghrrdhkvghrnhgvlhdrohhrghdpoffvtefjohhsthepmhhoheekuddpmhhouggvpehsmhhtphhouhht X-Spam-Status: No, score=-1.9 required=5.0 tests=BAYES_00, RCVD_IN_DNSWL_BLOCKED,RCVD_IN_MSPIKE_H4,RCVD_IN_MSPIKE_WL, SPF_HELO_NONE,SPF_PASS,T_SCC_BODY_TEXT_LINE,URIBL_BLOCKED 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 Le tiistaina 18. heinäkuuta 2023, 21.45.15 EEST Atish Patra a écrit : > > I agree that it's not only insecure but also incorrect. However it mostly > > works. In fact I don't disagree with the change as such, but I think that > > the commit messages are misleading and confusing. For a start, in one > > place it says that it is not breaking user space and in another it says > > basically the opposite. > > Agreed. We will improve the commit message to clarify that. That's also the > reason I started this whole thread :) > > > (Unfortunately, not everybody agrees with the change. I can't seem to get > > FFmpeg's checkasm tool fixed: > > http://ffmpeg.org/pipermail/ffmpeg-devel/2023-July/312245.html ) > > Why can't rdtime(equivalent of rdtsc) be used instead of rdcycle ? Isn't RDTIM susceptible to interference from power management and CPU frequency scaling? I suppose that RDCYCLE may behave differently depending on PM in *some* designs, but that would still be way better than RDTIME for the purpose. As far as benchmarking is concerned (_excluding_ system security), RDTIME seems to have all the problems of RDCYCLE, and then some more, no? > The perf syscall overhead is just one time setup thing during the > start of the application. > For counting the cycles before/after a loop, it still provides a > direct CSR access in user mode. I suppose that you allude to mmap() here? The (dumb) FFmpeg code is using the ioctl() interface though, but that's just laziness. -- レミ・デニ-クールモン http://www.remlab.net/