Received: by 2002:ab2:6c55:0:b0:1fd:c486:4f03 with SMTP id v21csp302170lqp; Wed, 12 Jun 2024 01:55:19 -0700 (PDT) X-Forwarded-Encrypted: i=3; AJvYcCV2P2YVkVPm+swLYtCZTDoGrZuqZY6rprINMv4ejvADPXIKjqEgfyLUroLGcRSs7Q9ojfcZZh4M9knLBihelBJIR2+g1lhv5xZAcEdqhQ== X-Google-Smtp-Source: AGHT+IFLylUsY7YfhIzZ+ZWkuGmWhoOpoY7awLDi7ulTkCgYi4obH66P1ry1FWg3it22aV2gXQ/u X-Received: by 2002:a05:620a:2407:b0:796:af63:b7c3 with SMTP id af79cd13be357-797f6173633mr142480285a.52.1718182519036; Wed, 12 Jun 2024 01:55:19 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1718182519; cv=pass; d=google.com; s=arc-20160816; b=Ad8rkgHxB8fRxbUIK8zPrjS6ixDtr5kv/h4wieQgtObCw6CEaBJHEBBYBtPKyfDjCd HkEx06IS2lvKcU0mm7yOxV5yC2+qqMM+DA2PCDlSrh0upvM8q2uIHTrHyzMoFQHUcMeG 1+bFOEFyqe3ARPuRuivcov6dSNdPKjtOPSg2TgNukny8k9CK+OvxcOSYyOpDra60Z5Yv Zaz7n74a+74fxQnv1NdvJ0GxuKPpxERQRk0xr29jG8d3M1XwSvyO5RoQbhD7D3oluvmO cw00Q+ccIE5RdHUQNVQVcgmdLQEhLDQWBH5yndI2MgbGyPCmk6XBUKgqGmVpa9rp+I7v npBA== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=cc:to:in-reply-to:references:message-id:content-transfer-encoding :mime-version:list-unsubscribe:list-subscribe:list-id:precedence :subject:date:from:feedback-id:dkim-signature:dkim-signature; bh=qq5phRqJvtRHtSHmkhaoyUkGaIs6cBNpExoO11sQiEE=; fh=EvY7dV+FIhCf/zpeIQvcugX4A/nQlQmuap7Xn+akpwY=; b=ONKnpes0jlml70UcAgBRbfrszpfItihDzdM8dT1FIY66tkRO0foEkUMe1mqWrDY89U 0oWxLMEg0GzxsHU2TIE/MCurZTHRcpry6Ea6G26LwS56PYQuhifJ/CGxS8wov3YeV9KG L09BR8IG/payBf7nYPwCpVcKVQa9vyQ9QehrurN3t8QvbL0khmzJdYoskcpCfaY3D7bV Tf9lct795or2FFJ1suVOXOhO8Ql4HbJ6hakf69hiU5TbpiA3iQ+WgNiQIaqlOWmoOdG9 Oe4HBFgN4BZ6wjZldBTsBoRx+HSW4xASp1QQomnK8fbWpobKEA1IehSpwu9iSnOB+9aS k42Q==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@flygoat.com header.s=fm2 header.b=P9PC9Bo1; dkim=pass header.i=@messagingengine.com header.s=fm1 header.b=hpvO1o8B; arc=pass (i=1 spf=pass spfdomain=flygoat.com dkim=pass dkdomain=flygoat.com dkim=pass dkdomain=messagingengine.com dmarc=pass fromdomain=flygoat.com); spf=pass (google.com: domain of linux-kernel+bounces-211214-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45d1:ec00::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-211214-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=flygoat.com Return-Path: Received: from ny.mirrors.kernel.org (ny.mirrors.kernel.org. [2604:1380:45d1:ec00::1]) by mx.google.com with ESMTPS id af79cd13be357-7956b8d5f3asi729818585a.526.2024.06.12.01.55.18 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 12 Jun 2024 01:55:19 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel+bounces-211214-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45d1:ec00::1 as permitted sender) client-ip=2604:1380:45d1:ec00::1; Authentication-Results: mx.google.com; dkim=pass header.i=@flygoat.com header.s=fm2 header.b=P9PC9Bo1; dkim=pass header.i=@messagingengine.com header.s=fm1 header.b=hpvO1o8B; arc=pass (i=1 spf=pass spfdomain=flygoat.com dkim=pass dkdomain=flygoat.com dkim=pass dkdomain=messagingengine.com dmarc=pass fromdomain=flygoat.com); spf=pass (google.com: domain of linux-kernel+bounces-211214-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45d1:ec00::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-211214-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=flygoat.com Received: from smtp.subspace.kernel.org (wormhole.subspace.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ny.mirrors.kernel.org (Postfix) with ESMTPS id B5D921C218CE for ; Wed, 12 Jun 2024 08:55:18 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id D4B9C16DEC5; Wed, 12 Jun 2024 08:54:37 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=flygoat.com header.i=@flygoat.com header.b="P9PC9Bo1"; dkim=pass (2048-bit key) header.d=messagingengine.com header.i=@messagingengine.com header.b="hpvO1o8B" Received: from fout5-smtp.messagingengine.com (fout5-smtp.messagingengine.com [103.168.172.148]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 4878116D9A1; Wed, 12 Jun 2024 08:54:35 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=103.168.172.148 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1718182476; cv=none; b=c4i66cU0wN1YA5JviFz81Sqw2ptFAxLC749t409ou/qEWG+XWju3PntDC4Pl3esT5cRREA6buKXXUXj4+V8KBnIHiyeZ22g6RyVFcHTFIkrwp+XXk2r+TwgcKjeCy5F+vmV7fnXdt1gR9ure218I9ONBCgacnp6/w7PxH61gtCw= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1718182476; c=relaxed/simple; bh=HlsMz4irpGQHhXBogt5PnjuY/xW84KRG9P+0pPj829g=; h=From:Date:Subject:MIME-Version:Content-Type:Message-Id:References: In-Reply-To:To:Cc; b=i13TVZq0o1Z8SNln16u0EDpASsBNyAqIs3kkYtMPqYaVmXSEDwhFKX+sAYfCTmNyHFtUixGW/vSX/lXAd6p9vukO9YX82ToEpXmPCrYDqvcHNrcLe7GKgWWf9DZp6Y44toOEswS11jC56UKPlMBEsWauxMXEtiy622/+0uKLdEk= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=flygoat.com; spf=pass smtp.mailfrom=flygoat.com; dkim=pass (2048-bit key) header.d=flygoat.com header.i=@flygoat.com header.b=P9PC9Bo1; dkim=pass (2048-bit key) header.d=messagingengine.com header.i=@messagingengine.com header.b=hpvO1o8B; arc=none smtp.client-ip=103.168.172.148 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=flygoat.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=flygoat.com Received: from compute4.internal (compute4.nyi.internal [10.202.2.44]) by mailfout.nyi.internal (Postfix) with ESMTP id 638AD138006A; Wed, 12 Jun 2024 04:54:34 -0400 (EDT) Received: from mailfrontend2 ([10.202.2.163]) by compute4.internal (MEProxy); Wed, 12 Jun 2024 04:54:34 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=flygoat.com; h= cc:cc:content-transfer-encoding:content-type:content-type:date :date:from:from:in-reply-to:in-reply-to:message-id:mime-version :references:reply-to:subject:subject:to:to; s=fm2; t=1718182474; x=1718268874; bh=qq5phRqJvtRHtSHmkhaoyUkGaIs6cBNpExoO11sQiEE=; b= P9PC9Bo1ZE+B4G1Z5AnR/uGMmcUw8f2wNz9wwuVJtYnWeHiVcnDpvF4Ka8XWvMza bpvcuePT6uVGXQ7x8m6VUKCifmsba5up8ldnvCcn2aRdu02Y2/tjCTXjZ7rMiFzk uNisYS/WxbBZpWPx1rQENToLMBLeNFH41zusnTAeza8jAv2zk8+l3oCXYDnrrSSA TWzTUuh/7Mzy8jlioxKjLs/d9DlbBDRHuIvknpWnIYQsuUYNNqz+kWYs23Y6hiZT zojNBsa2UfARu4OoX1YWDO/txzuIqMqoT8bI8Qt6kpyttYb1TLm2QEIHEBUlqTKz fF1B6rLzDsoZyLWT3EuihA== DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d= messagingengine.com; h=cc:cc:content-transfer-encoding :content-type:content-type:date:date:feedback-id:feedback-id :from:from:in-reply-to:in-reply-to:message-id:mime-version :references:reply-to:subject:subject:to:to:x-me-proxy:x-me-proxy :x-me-sender:x-me-sender:x-sasl-enc; s=fm1; t=1718182474; x= 1718268874; bh=qq5phRqJvtRHtSHmkhaoyUkGaIs6cBNpExoO11sQiEE=; b=h pvO1o8BABR4nKRjg08RZFbqLNZ5q6oZ1BHXCONAhulOduDNeX1ow/UVDh8t1AxYe 7VtjhJP85lhUZ/VvjVWrEqTbsPHjbX2IXheFAHjWpVsA/NcbDUAdo1lnujmBuyLQ t1gBaEiJMMvkNiiO+BgGkkyHpYPtwNitDr8uxyyLbGJfyZGPziWxG1IzSMZGCJa9 /3GUvYgz+4RPMv+VZo8VJFdWWiQGgb4yrppJky5D80t6RgZiF+KTTyM9ERk7FL6J t75vUs/XRbWtJ6NsGbb+crXA9TAg5Z+6eV9SaN0EOQS4q8tsMmwh5RF7iDzVekb0 0hZq5C6BXjfKmsRf8aV5Q== X-ME-Sender: X-ME-Received: X-ME-Proxy-Cause: gggruggvucftvghtrhhoucdtuddrgedvledrfedugedgtdelucetufdoteggodetrfdotf fvucfrrhhofhhilhgvmecuhfgrshhtofgrihhlpdfqfgfvpdfurfetoffkrfgpnffqhgen uceurghilhhouhhtmecufedttdenucesvcftvggtihhpihgvnhhtshculddquddttddmne cujfgurhephfffufggtgfgkfhfjgfvvefosehtjeertdertdejnecuhfhrohhmpeflihgr gihunhcujggrnhhguceojhhirgiguhhnrdihrghnghesfhhlhihgohgrthdrtghomheqne cuggftrfgrthhtvghrnhepvdekiefhfeevkeeuveetfeelffekgedugefhtdduudeghfeu veegffegudekjeelnecuvehluhhsthgvrhfuihiivgeptdenucfrrghrrghmpehmrghilh hfrhhomhepjhhirgiguhhnrdihrghnghesfhhlhihgohgrthdrtghomh X-ME-Proxy: Feedback-ID: ifd894703:Fastmail Received: by mail.messagingengine.com (Postfix) with ESMTPA; Wed, 12 Jun 2024 04:54:33 -0400 (EDT) From: Jiaxun Yang Date: Wed, 12 Jun 2024 09:54:28 +0100 Subject: [PATCH v2 1/7] MIPS: csrc-r4k: Refine rating computation Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: 7bit Message-Id: <20240612-mips-clks-v2-1-a57e6f49f3db@flygoat.com> References: <20240612-mips-clks-v2-0-a57e6f49f3db@flygoat.com> In-Reply-To: <20240612-mips-clks-v2-0-a57e6f49f3db@flygoat.com> To: Thomas Bogendoerfer , Serge Semin , Daniel Lezcano , Thomas Gleixner Cc: "Maciej W. Rozycki" , linux-mips@vger.kernel.org, linux-kernel@vger.kernel.org, Jiaxun Yang X-Mailer: b4 0.13.0 X-Developer-Signature: v=1; a=openpgp-sha256; l=1085; i=jiaxun.yang@flygoat.com; h=from:subject:message-id; bh=HlsMz4irpGQHhXBogt5PnjuY/xW84KRG9P+0pPj829g=; b=kA0DAAoWQ3EMfdd3KcMByyZiAGZpYkegzN7T0kZ1f0Umu6LlQMQvmIIND+o50wHSC/vA89Zbj Ih1BAAWCgAdFiEEVBAijrCB0aDX4Gr8Q3EMfdd3KcMFAmZpYkcACgkQQ3EMfdd3KcMEBAEAzrsw dG+lT1qiTlr3PUPDNYjvF/4Qz8Nal696U78Mo7MA/2KExIY0xLGEFEH85f3RTQasM9C34eS/46Y 7pAk9UZIC X-Developer-Key: i=jiaxun.yang@flygoat.com; a=openpgp; fpr=980379BEFEBFBF477EA04EF9C111949073FC0F67 Increase frequency addend dividend to 10000000 (10MHz) to reasonably accommodate multi GHz level mips_hpt_frequency. Cap rating of csrc-r4k into 299 to ensure it doesn't go into "Desired" range, given all the drama we have with CP0 count registers (SMP sync, behaviour on wait etc). Signed-off-by: Jiaxun Yang --- v2: Fix up number of zeros for 10 MHz (Maciej) --- arch/mips/kernel/csrc-r4k.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/arch/mips/kernel/csrc-r4k.c b/arch/mips/kernel/csrc-r4k.c index edc4afc080fa..f02ae333f4f9 100644 --- a/arch/mips/kernel/csrc-r4k.c +++ b/arch/mips/kernel/csrc-r4k.c @@ -111,7 +111,8 @@ int __init init_r4k_clocksource(void) return -ENXIO; /* Calculate a somewhat reasonable rating value */ - clocksource_mips.rating = 200 + mips_hpt_frequency / 10000000; + clocksource_mips.rating = 200; + clocksource_mips.rating += clamp(mips_hpt_frequency / 10000000, 0, 99); /* * R2 onwards makes the count accessible to user mode so it can be used -- 2.43.0