From patchwork Thu Oct 12 18:23:43 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Rafael J. Wysocki" X-Patchwork-Id: 15292 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a05:612c:2908:b0:403:3b70:6f57 with SMTP id ib8csp1427288vqb; Thu, 12 Oct 2023 11:36:19 -0700 (PDT) X-Google-Smtp-Source: AGHT+IGRC2qGrGvh+As9t88aGLLinNwKYFFVQw9eaROKeC53+b4nSbM35dMEHe2OVqIRBbGZHbDR X-Received: by 2002:a05:6a00:2d1b:b0:68e:3eff:e93a with SMTP id fa27-20020a056a002d1b00b0068e3effe93amr26736231pfb.2.1697135779110; Thu, 12 Oct 2023 11:36:19 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1697135779; cv=none; d=google.com; s=arc-20160816; b=qTivgbrvy0t0yiQgqnSu/LzdFaywmidwy3uXOhwnZzr376vq71NtYv1eYN/TPcGc13 6On/hRoXxvKZUcX6VS6I7ulq6cp+whjxaCveYfXa3hXVNe5hEUxGJuzq8wDhj342vKqQ X9KUKZ3wmcgQj6Ibz64M6cwJqr6bORc4kne+il4KjJ95rEvc7wnb9S5V9IiASe7JGg3y 9n9qlRYu766WD4w5WmIicz7GEg3E9Zv8rdMkrXh4rZAVRCRaWUT86MYxyh8sqciieeJc evL3SY3cehRk2wAeOTEPKRNBT16tMxt6EqJvLqZvbjHIYdqfBrbK3JuvQ6Il4GRaUb3g vxAw== 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 :message-id:date:subject:cc:to:from; bh=Bsh2i1U+6OiQbp6GwKW/3eh1v68yi3qnjD2k83ZeUIY=; fh=7MtGe3Dn5wgXLQQm5DZb5OyhwmEFEEdRNCLYMJcP5yE=; b=1FWgE5+WkC0tCZoONaavtfPo3NdhcLxvu/A/peR/pJFqiCA4KA1Jt6HF92NQ8/U4SP ByfzfADPMcA7p3Ys4HelmEQ+yn4JegrythdjN7XiJqhamHZAcd83YS2kf+xuP1r6UL7j GVcfM2OGhLBtx+BgmqeXJWYMJwGQjJMyZzL4btyOy79TnlHECvZL72chlK3dJtyhhnjg v4GsObQ5sgV3XkGd9I72Hf6kYtsfhFRE1AgMNasWz3dY16JJOfPbhGmvpPT44lYTq/Pg +qWQ5m9WABEdXuhubXcNXQnO5rcgyIIOzBvrC+3aSJeG8KePpHAuui1PgxhoW61MWpOr +TdA== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.35 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: from groat.vger.email (groat.vger.email. [23.128.96.35]) by mx.google.com with ESMTPS id c5-20020a6566c5000000b0057400b568aesi2699252pgw.620.2023.10.12.11.36.18 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 12 Oct 2023 11:36:19 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.35 as permitted sender) client-ip=23.128.96.35; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.35 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: from out1.vger.email (depot.vger.email [IPv6:2620:137:e000::3:0]) by groat.vger.email (Postfix) with ESMTP id 34A7680740FD; Thu, 12 Oct 2023 11:35:48 -0700 (PDT) X-Virus-Status: Clean X-Virus-Scanned: clamav-milter 0.103.10 at groat.vger.email Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1442163AbjJLSfV (ORCPT + 19 others); Thu, 12 Oct 2023 14:35:21 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:35434 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1441952AbjJLSfI (ORCPT ); Thu, 12 Oct 2023 14:35:08 -0400 Received: from cloudserver094114.home.pl (cloudserver094114.home.pl [79.96.170.134]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id D9B31CF; Thu, 12 Oct 2023 11:35:06 -0700 (PDT) Received: from localhost (127.0.0.1) (HELO v370.home.net.pl) by /usr/run/smtp (/usr/run/postfix/private/idea_relay_lmtp) via UNIX with SMTP (IdeaSmtpServer 5.2.0) id 272b597e78663fd7; Thu, 12 Oct 2023 20:35:05 +0200 Received: from kreacher.localnet (unknown [195.136.19.94]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256) (No client certificate requested) by cloudserver094114.home.pl (Postfix) with ESMTPSA id 81206666870; Thu, 12 Oct 2023 20:35:04 +0200 (CEST) From: "Rafael J. Wysocki" To: Linux PM Cc: LKML , Daniel Lezcano , Srinivas Pandruvada , Zhang Rui , Lukasz Luba Subject: [PATCH v2 0/6] thermal: core: Pass trip pointers to governor .throttle() callbacks Date: Thu, 12 Oct 2023 20:23:43 +0200 Message-ID: <5734364.DvuYhMxLoT@kreacher> MIME-Version: 1.0 X-CLIENT-IP: 195.136.19.94 X-CLIENT-HOSTNAME: 195.136.19.94 X-VADE-SPAMSTATE: clean X-VADE-SPAMCAUSE: gggruggvucftvghtrhhoucdtuddrgedvkedriedtgdduudeiucetufdoteggodetrfdotffvucfrrhhofhhilhgvmecujffqoffgrffnpdggtffipffknecuuegrihhlohhuthemucduhedtnecusecvtfgvtghiphhivghnthhsucdlqddutddtmdenucfjughrpefhvfevufffkfgggfgtsehtufertddttdejnecuhfhrohhmpedftfgrfhgrvghlucflrdcuhgihshhotghkihdfuceorhhjfiesrhhjfiihshhotghkihdrnhgvtheqnecuggftrfgrthhtvghrnhepgeffhfdujeelhfdtgeffkeetudfhtefhhfeiteethfekvefgvdfgfeeikeeigfehnecuffhomhgrihhnpehkvghrnhgvlhdrohhrghenucfkphepudelhedrudefiedrudelrdelgeenucevlhhushhtvghrufhiiigvpedtnecurfgrrhgrmhepihhnvghtpeduleehrddufeeirdduledrleegpdhhvghlohepkhhrvggrtghhvghrrdhlohgtrghlnhgvthdpmhgrihhlfhhrohhmpedftfgrfhgrvghlucflrdcuhgihshhotghkihdfuceorhhjfiesrhhjfiihshhotghkihdrnhgvtheqpdhnsggprhgtphhtthhopeeipdhrtghpthhtoheplhhinhhugidqphhmsehvghgvrhdrkhgvrhhnvghlrdhorhhgpdhrtghpthhtoheplhhinhhugidqkhgvrhhnvghlsehvghgvrhdrkhgvrhhnvghlrdhorhhgpdhrtghpthhtohepuggrnhhivghlrdhlvgiitggrnhhosehlihhnrghrohdrohhrghdprhgtphhtthhopehsrhhinhhivhgrshdrphgrnhgu rhhuvhgruggrsehlihhnuhigrdhinhhtvghlrdgtohhmpdhrtghpthhtoheprhhuihdriihhrghnghesihhnthgvlhdrtghomhdprhgtphhtthhopehluhhkrghsiidrlhhusggrsegrrhhmrdgtohhm X-DCC--Metrics: v370.home.net.pl 1024; Body=6 Fuz1=6 Fuz2=6 X-Spam-Status: No, score=-0.8 required=5.0 tests=HEADER_FROM_DIFFERENT_DOMAINS, MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS autolearn=unavailable autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on groat.vger.email 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 (groat.vger.email [0.0.0.0]); Thu, 12 Oct 2023 11:35:48 -0700 (PDT) X-getmail-retrieved-from-mailbox: INBOX X-GMAIL-THRID: 1779575846537757651 X-GMAIL-MSGID: 1779575846537757651 Hi All, This is a v2 of https://lore.kernel.org/linux-pm/13365827.uLZWGnKmhe@kreacher/ which only slightly updates 2 patches and adds some tags, so the cover letter below is still applicable: While working on https://lore.kernel.org/linux-pm/4846448.GXAFRqVoOG@kreacher/ I started to change thermal governors so as to reduce the usage of trip indices in them. At that time, I was concerned that they could not be replaced with trip pointers overall, because they were needed in certain situations (tracing, debug messages, userspace governor) and computing them whenever they were needed would be extra overhead with relatively weak justification. In the meantime, however, I realized that for a given trip pointer, it is actually trivial to compute the corresponding index: it is sufficient to subtract the start of the trips[] table in the thermal zone containing the trip from that trip pointer for this purpose. Patch [1/6] modifies thermal_zone_trip_id() in accordance with this observation. Now that the cost of computing a trip index for a given trip pointer and thermal zone is not a concern any more, the governors can be generally switched over to using trip pointers for representing trips. One of the things they need to do sometimes, though, is to iterate over trips in a given thermal zone (the core needs to do that too, of course) and for_each_thermal_trip() is somewhat inconvenient for this purpose, because it requires callback functions to be defined and in some cases new data types need to be introduced just in order to use it. For this reason, patch [2/6] adds a macro for iterating over trip points in a given thermal zone with the help of a trip pointer and changes for_each_thermal_trip() to use that macro internally. Patches [3-5/6] change individual governors to prepare them for using trip pointers everywhere for representing trips, except for the trip argument of the .throttle() callback and patch [6/6] finally changes the .throttle() callback definition so that it takes a trip pointer as the argument representing the trip. Please refer to the individual patch changelogs for details. Thanks!