Message ID | 13365827.uLZWGnKmhe@kreacher |
---|---|
Headers |
Return-Path: <linux-kernel-owner@vger.kernel.org> Delivered-To: ouuuleilei@gmail.com Received: by 2002:a59:a888:0:b0:403:3b70:6f57 with SMTP id x8csp499191vqo; Fri, 6 Oct 2023 10:52:19 -0700 (PDT) X-Google-Smtp-Source: AGHT+IHBMPiXn4LvCLlQu4oJSwPyvaQ8pD/Y8mT5gqFpPyVK8yeznV5I47EZt2LwFLmv341N7GEY X-Received: by 2002:a17:90b:4b8b:b0:274:6d36:5b32 with SMTP id lr11-20020a17090b4b8b00b002746d365b32mr8231028pjb.30.1696614739516; Fri, 06 Oct 2023 10:52:19 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1696614739; cv=none; d=google.com; s=arc-20160816; b=PyAPuZR5aPvz6o94rbY97u14fbNPp7jVFuCqwN0kjfifaz1AoY+IfeXXzvWC/azQCl 4FrrV3XKsWnkP8ppRcBTJ2dMkpYQNZC1MKKpoV2dzQC48FsXeLDBXi98M/RqI1etXz7J h7E85S744/JgfokvtYBLGDVht4t4IVlC/Gu+s2+CMWTf18+8eGHtjBS/xjm1aLGepkD7 U6opVEf1pWV7VAlPrbaf25LprA5Pfi9ZN54AA7O7G6hrhIOy9uSUgrYcHnBEPqaIKP0G KkXXaiy/V/e3XSM4sB9gazArkNclWAZ4VSZNIXKnuu2UdgIR7sqSdPzP7NXa362MVOVU P22w== 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=f6HRDCg1Z9BsYvC2O8pcbIyPnQyvnSpqxNmeHRmlWFA=; fh=7MtGe3Dn5wgXLQQm5DZb5OyhwmEFEEdRNCLYMJcP5yE=; b=xf1/ESAKNFkFU/2++y9tJjfqx8Ek/qi1mSYGPTpDJ5NSJ5696ezhvgjVUg8AGLUCG9 hlqAk90n4b3boA1NG88Zx9BC9X87weokM4gUQdf5rArxuODuiRPTWTCkjTbUguHX9Swe Sw6nP4V8dnUydKIK5tTQiC5O87gSRqKQsgphE8Lb96XTZm7RLFQy4nxBjaZxKO+en+DG gWI1rWVCEnhm9fsGbs7OnA1PyfNOm/R9Qu33hJLQo/M20dYOcHMbKML747ictAVK1Kxf l4ylqfwvfIVrvIYoW8jtSIzaMobsRgSUCUQwckbCP/TBZX6MlOv1m6l5hIVq8YQDtTA4 rM7A== 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 il7-20020a17090b164700b00274dc876792si4558077pjb.98.2023.10.06.10.52.19 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 06 Oct 2023 10:52: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 580E28262E03; Fri, 6 Oct 2023 10:52:15 -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 S233100AbjJFRvt (ORCPT <rfc822;ezelljr.billy@gmail.com> + 18 others); Fri, 6 Oct 2023 13:51:49 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:35810 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S233083AbjJFRve (ORCPT <rfc822;linux-kernel@vger.kernel.org>); Fri, 6 Oct 2023 13:51:34 -0400 Received: from cloudserver094114.home.pl (cloudserver094114.home.pl [79.96.170.134]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id E1EB6BE; Fri, 6 Oct 2023 10:51:32 -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 fe1c702b030d306b; Fri, 6 Oct 2023 19:51:31 +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 v370.home.net.pl (Postfix) with ESMTPSA id E4A8F665D08; Fri, 6 Oct 2023 19:51:30 +0200 (CEST) From: "Rafael J. Wysocki" <rjw@rjwysocki.net> To: Linux PM <linux-pm@vger.kernel.org> Cc: LKML <linux-kernel@vger.kernel.org>, Daniel Lezcano <daniel.lezcano@linaro.org>, Srinivas Pandruvada <srinivas.pandruvada@linux.intel.com>, Zhang Rui <rui.zhang@intel.com>, Lukasz Luba <lukasz.luba@arm.com> Subject: [PATCH v1 0/6] thermal: core: Pass trip pointers to governor .throttle() callbacks Date: Fri, 06 Oct 2023 19:38:28 +0200 Message-ID: <13365827.uLZWGnKmhe@kreacher> MIME-Version: 1.0 Content-Transfer-Encoding: 7Bit Content-Type: text/plain; charset="UTF-8" X-CLIENT-IP: 195.136.19.94 X-CLIENT-HOSTNAME: 195.136.19.94 X-VADE-SPAMSTATE: clean X-VADE-SPAMCAUSE: gggruggvucftvghtrhhoucdtuddrgedvkedrgeeigdduudeiucetufdoteggodetrfdotffvucfrrhhofhhilhgvmecujffqoffgrffnpdggtffipffknecuuegrihhlohhuthemucduhedtnecusecvtfgvtghiphhivghnthhsucdlqddutddtmdenucfjughrpefhvfevufffkfgggfgtsehtufertddttdejnecuhfhrohhmpedftfgrfhgrvghlucflrdcuhgihshhotghkihdfuceorhhjfiesrhhjfiihshhotghkihdrnhgvtheqnecuggftrfgrthhtvghrnhepgeffhfdujeelhfdtgeffkeetudfhtefhhfeiteethfekvefgvdfgfeeikeeigfehnecuffhomhgrihhnpehkvghrnhgvlhdrohhrghenucfkphepudelhedrudefiedrudelrdelgeenucevlhhushhtvghrufhiiigvpedtnecurfgrrhgrmhepihhnvghtpeduleehrddufeeirdduledrleegpdhhvghlohepkhhrvggrtghhvghrrdhlohgtrghlnhgvthdpmhgrihhlfhhrohhmpedftfgrfhgrvghlucflrdcuhgihshhotghkihdfuceorhhjfiesrhhjfiihshhotghkihdrnhgvtheqpdhnsggprhgtphhtthhopeeipdhrtghpthhtoheplhhinhhugidqphhmsehvghgvrhdrkhgvrhhnvghlrdhorhhgpdhrtghpthhtoheplhhinhhugidqkhgvrhhnvghlsehvghgvrhdrkhgvrhhnvghlrdhorhhgpdhrtghpthhtohepuggrnhhivghlrdhlvgiitggrnhhosehlihhnrghrohdrohhrghdprhgtphhtthhopehsrhhinhhivhgrshdrphgrnhgu rhhuvhgruggrsehlihhnuhigrdhinhhtvghlrdgtohhmpdhrtghpthhtoheprhhuihdriihhrghnghesihhnthgvlhdrtghomhdprhgtphhtthhopehluhhkrghsiidrlhhusggrsegrrhhmrdgtohhm X-DCC--Metrics: v370.home.net.pl 1024; Body=6 Fuz1=6 Fuz2=6 X-Spam-Status: No, score=2.8 required=5.0 tests=HEADER_FROM_DIFFERENT_DOMAINS, MAILING_LIST_MULTI,RCVD_IN_SBL_CSS,SPF_HELO_NONE,SPF_PASS autolearn=no 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: <linux-kernel.vger.kernel.org> 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]); Fri, 06 Oct 2023 10:52:15 -0700 (PDT) X-Spam-Level: ** X-getmail-retrieved-from-mailbox: INBOX X-GMAIL-THRID: 1779029497209930580 X-GMAIL-MSGID: 1779029497209930580 |
Series |
thermal: core: Pass trip pointers to governor .throttle() callbacks
|
|
Message
Rafael J. Wysocki
Oct. 6, 2023, 5:38 p.m. UTC
Hi All, 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!
Comments
Hi Rafael, On 10/6/23 18:38, Rafael J. Wysocki wrote: > Hi All, > > 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! > > > I have issues to apply this series, could you tell me the best base branch from your tree? I will give it a try on my boards and review. Thanks, Lukasz
Hi Lukasz, On Fri, Oct 13, 2023 at 10:12 AM Lukasz Luba <lukasz.luba@arm.com> wrote: > > Hi Rafael, > > > On 10/6/23 18:38, Rafael J. Wysocki wrote: > > Hi All, > > > > 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! > > > > > > > > I have issues to apply this series, could you tell me the best > base branch from your tree? > > I will give it a try on my boards and review. It is there in the thermal-core branch of linux-pm.git. Thanks!