Received: by 2002:a05:7412:2a8c:b0:e2:908c:2ebd with SMTP id u12csp3577498rdh; Thu, 28 Sep 2023 16:37:23 -0700 (PDT) X-Google-Smtp-Source: AGHT+IFDDsW87pLITdwlg6ZVACApgqZJSFLmiheTQbIYGII22J7gkx+xN0qQxYyb7sLvL7L/rDPt X-Received: by 2002:a05:6358:90f:b0:135:b4c:a490 with SMTP id r15-20020a056358090f00b001350b4ca490mr3320241rwi.10.1695944243619; Thu, 28 Sep 2023 16:37:23 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1695944243; cv=none; d=google.com; s=arc-20160816; b=I7hV/1W0y+x3dTbDmcdZf+NXNlys4Ap6U+qi+Ty/1wJNoOI8M2V8ruN55lQFVuSoBU pIKHGfgDGNBQoRzREFQVM/2cy8+2XLcYWGQrB5Oc9HhZO9QcIyM/60t/8HQi3lD/auQI wAhpbrhm0m/fjHSwAlaPIFJ9G5eoiqrkVzszr1xZmMgD7+/oTduCvc6i9OaeWkp2pTqw QtN6V1p20Kx7nemZZGayDI0V7Vj05SW5tk5JRKD8HEvTAoc+J5qob+JeswDUNUa11Cyz cQvkdLbLlwmCzq9b+CW5QSEYgftn4HeihJso4zbeelXypXdsY+FSlisV0Szq3ZtElsSE MGug== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:in-reply-to:from :references:cc:to:content-language:subject:user-agent:mime-version :date:message-id:dkim-signature; bh=kI7xhtv1up4cUf/uSqI2zpGGqMta0B7Fjm2QJg7v1Ho=; fh=MXrBe1I/D4cgntoT2cNWP+XrancaLCF/IeeSyZ9FiM8=; b=JEz+nrmrfg5BALL+Hbq8PVyCqTjv37Q5OJjB3mOOLz3K58B60YBKgks1i7h0CFTM98 uD7N8LIDGmaHS2ldQ90LGUZuUwWfUdxAtVbp0q5EkQ9cODlmetp4LEfZI3rJOPPzypVY FfZ8hIH8IZF3BOHLkH83R5TruH9xO0+JHg3zEF0jqduumtlt6GpWN+ZiZ3VqTdlwxJSm Y19VyChJ79jawgqTyCWGunGyUsiT4srYmQxBcuYLvRgmpWVY1KhRgMs8LRdrCGDmeHgg /jrdwmJ95oAncMOcrTNNlyoIbYcLKhgNH0YDMWikgkDGqTvXJehiwCR3U6CSG7kcnjfq g2pA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@sifive.com header.s=google header.b=DUtuTyHG; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.34 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=REJECT sp=REJECT dis=NONE) header.from=sifive.com Return-Path: Received: from howler.vger.email (howler.vger.email. [23.128.96.34]) by mx.google.com with ESMTPS id x33-20020a634861000000b00578a7f5a0b1si19626056pgk.393.2023.09.28.16.37.23 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 28 Sep 2023 16:37:23 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.34 as permitted sender) client-ip=23.128.96.34; Authentication-Results: mx.google.com; dkim=pass header.i=@sifive.com header.s=google header.b=DUtuTyHG; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.34 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=REJECT sp=REJECT dis=NONE) header.from=sifive.com Received: from out1.vger.email (depot.vger.email [IPv6:2620:137:e000::3:0]) by howler.vger.email (Postfix) with ESMTP id 8233B840B7FE; Thu, 28 Sep 2023 09:33:47 -0700 (PDT) X-Virus-Status: Clean X-Virus-Scanned: clamav-milter 0.103.10 at howler.vger.email Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229870AbjI1Qdn (ORCPT + 99 others); Thu, 28 Sep 2023 12:33:43 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:59392 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229639AbjI1Qdm (ORCPT ); Thu, 28 Sep 2023 12:33:42 -0400 Received: from mail-qv1-xf34.google.com (mail-qv1-xf34.google.com [IPv6:2607:f8b0:4864:20::f34]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 2ABFB195 for ; Thu, 28 Sep 2023 09:33:40 -0700 (PDT) Received: by mail-qv1-xf34.google.com with SMTP id 6a1803df08f44-65afae9e51fso57253636d6.0 for ; Thu, 28 Sep 2023 09:33:40 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=sifive.com; s=google; t=1695918819; x=1696523619; darn=vger.kernel.org; h=content-transfer-encoding:in-reply-to:from:references:cc:to :content-language:subject:user-agent:mime-version:date:message-id :from:to:cc:subject:date:message-id:reply-to; bh=kI7xhtv1up4cUf/uSqI2zpGGqMta0B7Fjm2QJg7v1Ho=; b=DUtuTyHG0b6gmTSG3lNDKW9OQox4Bl1tdDNCetGIngwxdMeouEQh6VyZlIrDXo4ZBB JCTTSXc+Qrf2mRF90uiWKgE8YB6ExCrYQXxOifpMCWz0rJ9IiBeudMXGEhLZEifByqHH Te3vU0zzyFkgaQ8W1C3ls/FtY5meHMI/L5wOow10tzlCHvY4TJ3VXLDIYW088uO0ks+0 YGTuDi0xvL9lQfkwgGYTp63RRpxy0oLAp1AqqSHSCW6/4JMcYJFPDCmrRYIsyOB3BeHw R5GDKLckZQqbolCvqISCX3BgOJYWThHtQuTODgon440rqcHYhkyyKKRJK5eJ/HQ60zmC G89Q== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1695918819; x=1696523619; h=content-transfer-encoding:in-reply-to:from:references:cc:to :content-language:subject:user-agent:mime-version:date:message-id :x-gm-message-state:from:to:cc:subject:date:message-id:reply-to; bh=kI7xhtv1up4cUf/uSqI2zpGGqMta0B7Fjm2QJg7v1Ho=; b=HqYFhk3pqDYycDhISho9KrGNCmx5o5L65qyoREIdDwyaLOBMHcolXgATWE8Fwa0kqk ggqYnNbqHMMX1t1A8HfevPdxMYS7qFk5bY9u/VxqPu5dGSr3vm2ZJo6JYaClbCSY7GN9 YVy0p9LLbessnkDT+6/bIcySiamVcKrQahoW8PPfhPvBCUaZnugmWoampnPBSn9KcMC/ L0Z7fPZP0QzJjYksqy88kYSdKWkvX17TOcFEACfC2wHgwrjKeT1nai/yoA+Fbqa62jsG 8x55AtqdZ/FLEEuMUaD2c+C2E4zDSuEpTfwoDkLeFbMNy6kKn1i2IghIBd6Dx/3o0P0h p49w== X-Gm-Message-State: AOJu0Yy/ZmAr20GAsmUyFIX3bgTfYnhrFjYUg+JiO9hGqfrUpdnz0vOx wSNk+GAofUsBwQHUPQw3pn6BPA== X-Received: by 2002:a0c:dd87:0:b0:658:a043:376b with SMTP id v7-20020a0cdd87000000b00658a043376bmr1628798qvk.8.1695918819251; Thu, 28 Sep 2023 09:33:39 -0700 (PDT) Received: from ?IPV6:2600:1700:2000:b002:5086:8bae:a4b0:bdad? ([2600:1700:2000:b002:5086:8bae:a4b0:bdad]) by smtp.gmail.com with ESMTPSA id x18-20020a0cb212000000b0064733ac9a9dsm6755734qvd.122.2023.09.28.09.33.38 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Thu, 28 Sep 2023 09:33:38 -0700 (PDT) Message-ID: <5f762ab8-c4d3-4ccb-af77-10c2692e5ec2@sifive.com> Date: Thu, 28 Sep 2023 11:33:37 -0500 MIME-Version: 1.0 User-Agent: Mozilla Thunderbird Subject: Re: [PATCH] clocksource/drivers/riscv: Increase the clock_event rating Content-Language: en-US To: "Lad, Prabhakar" Cc: Daniel Lezcano , Thomas Gleixner , Paul Walmsley , Palmer Dabbelt , Albert Ou , Samuel Holland , Anup Patel , Geert Uytterhoeven , Conor Dooley , Biju Das , linux-kernel@vger.kernel.org, linux-riscv@lists.infradead.org, linux-renesas-soc@vger.kernel.org, Lad Prabhakar References: <20230928104520.24768-1-prabhakar.mahadev-lad.rj@bp.renesas.com> <4e4bf02b-2264-491e-9b71-ae3b5ad7fc39@sifive.com> From: Samuel Holland In-Reply-To: Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-Spam-Status: No, score=-2.1 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_BLOCKED, SPF_HELO_NONE,SPF_PASS 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 X-Greylist: Sender passed SPF test, not delayed by milter-greylist-4.6.4 (howler.vger.email [0.0.0.0]); Thu, 28 Sep 2023 09:33:47 -0700 (PDT) Hi Prabhakar, On 2023-09-28 11:18 AM, Lad, Prabhakar wrote: > On Thu, Sep 28, 2023 at 5:04 PM Samuel Holland > wrote: >> >> On 2023-09-28 5:45 AM, Prabhakar wrote: >>> From: Lad Prabhakar >>> >>> Renesas RZ/Five SoC has OSTM blocks which can be used for clock_event and >>> clocksource [0]. The clock_event rating for the OSTM is set 300 but >>> whereas the rating for riscv-timer clock_event is set to 100 due to which >>> the kernel is choosing OSTM for clock_event. >>> >>> As riscv-timer is much more efficient than MMIO clock_event, increase the >>> rating to 400 so that the kernel prefers riscv-timer over the MMIO based >>> clock_event. >> >> This is only true if you have the Sstc extension and can set stimecmp directly. >> Otherwise you have the overhead of an SBI call, which is going to be much higher >> than an MMIO write. So the rating should depend on Sstc, as in this patch: >> >> https://lore.kernel.org/linux-riscv/20230710131902.1459180-3-apatel@ventanamicro.com/ >> > Thank you for the pointer. Do you know any tool/util which I can use > to make comparisons? To measure the latency of the trap to M-mode when receiving the timer interrupt, you could use the timerlat tracer. This computes the delta between the programmed timestamp, and when the IRQ is actually handled. To measure the latency of setting the timer, you could add code to compute the duration of the set_next_event functions. (min_delta_ns won't tell you anything because set_next_event never fails.) Regards, Samuel