Message ID | 1880915.tdWV9SEqCh@kreacher |
---|---|
Headers |
Return-Path: <linux-kernel-owner@vger.kernel.org> Delivered-To: ouuuleilei@gmail.com Received: by 2002:a59:bcd1:0:b0:403:3b70:6f57 with SMTP id r17csp5669307vqy; Fri, 8 Dec 2023 11:21:10 -0800 (PST) X-Google-Smtp-Source: AGHT+IFUxnm1wFgMyojhVb1BLQTvbKiojWuGCXtgegAvrB7N/sJsb3mLsxQc/BToMdEo03AKi1bt X-Received: by 2002:a05:6a00:a13:b0:6ce:4059:2300 with SMTP id p19-20020a056a000a1300b006ce40592300mr569718pfh.27.1702063270173; Fri, 08 Dec 2023 11:21:10 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1702063270; cv=none; d=google.com; s=arc-20160816; b=zgBlbjcImIpODY4DFvBjJVXa1FQcC3trUEPWQ5d/U7humrrugkuUiqyXBKwFpLpfSL QirsUBQXQ9WV4poQ5CpDq2qudrBEaq4fymWPcndWEahUbSAwLtZ4LGEIqF4nu4SUV0Zr tjALmbOQz644adoKGGiadfxtDQTfhgHQ0RBuC5EWvLXov9NDSdk6zcGKGwaH/Q1+sZOC J4mVv9daezE6VVSFq/deWEfcowIsxbPr7UFneGEKjveWcMJ94dV79LH+IOmM54rD2wlD Xo8TEVdRHn2wZwRWnVMWMrKFYvoKrwZXwrf1ZJU1sbmqOEw/wS9UtZpEGvPMsKrYtNvZ 0C9g== 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=ND5kAFsONbrLFBBG7FBTn9sNePI0QE4tN0I6XY9//2c=; fh=PrtSuD01Zw+FPDhsRSNqLGqZbVeJkC2wpKMU0Il46xE=; b=g2mRdWLjFIH2HICtGaZWM7+0iAXMTr6OcOQFXWmlriYRxKw5zdOC3HSL6acHwbuvpN 2aQeQ9EBDKhxkZ0Pqm75DscLyKNBqbFEVk6Lx9vmpY180X4+l7aDI2OcTcAZbMsq4Shc R7i5+QsLhjZYAPG2UYxSrgsWdDOOK2lRm0A5ErEjm+MPGmR0gemU536rd2SIFJ9gmAln P7UDYmQK/sVjuaNRgynUNr5RysPs9yeyiGkqmetbt9Dpr1OZFl2fdq9ZiNrH6eV0A9re mYNh+LPfuMadUTV68yY4vMp7KWxMApieV0gGP8AvZMe6SIgfh1MB6gw9maYqVIeIebSf CEwg== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.37 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: from snail.vger.email (snail.vger.email. [23.128.96.37]) by mx.google.com with ESMTPS id f14-20020a056a0022ce00b006cde1cef718si1948160pfj.322.2023.12.08.11.21.09 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 08 Dec 2023 11:21:10 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.37 as permitted sender) client-ip=23.128.96.37; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.37 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 snail.vger.email (Postfix) with ESMTP id D30AB810659D; Fri, 8 Dec 2023 11:21:08 -0800 (PST) X-Virus-Status: Clean X-Virus-Scanned: clamav-milter 0.103.11 at snail.vger.email Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1574671AbjLHTUw (ORCPT <rfc822;ezelljr.billy@gmail.com> + 99 others); Fri, 8 Dec 2023 14:20:52 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:35202 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230253AbjLHTUk (ORCPT <rfc822;linux-kernel@vger.kernel.org>); Fri, 8 Dec 2023 14:20:40 -0500 Received: from cloudserver094114.home.pl (cloudserver094114.home.pl [79.96.170.134]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id D88EF10FA; Fri, 8 Dec 2023 11:20:46 -0800 (PST) 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.4.0) id 3ceef50cff98a7b6; Fri, 8 Dec 2023 20:20:45 +0100 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 DD0AF6688FC; Fri, 8 Dec 2023 20:20:44 +0100 (CET) From: "Rafael J. Wysocki" <rjw@rjwysocki.net> To: Linux PM <linux-pm@vger.kernel.org> Cc: Srinivas Pandruvada <srinivas.pandruvada@linux.intel.com>, Daniel Lezcano <daniel.lezcano@linaro.org>, Zhang Rui <rui.zhang@intel.com>, Linux ACPI <linux-acpi@vger.kernel.org>, LKML <linux-kernel@vger.kernel.org>, Lukasz Luba <lukasz.luba@arm.com> Subject: [PATCH v1 0/3] thermal: core: Remove thermal zones during unregistration Date: Fri, 08 Dec 2023 20:11:51 +0100 Message-ID: <1880915.tdWV9SEqCh@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: gggruggvucftvghtrhhoucdtuddrgedvkedrudekiedguddvhecutefuodetggdotefrodftvfcurfhrohhfihhlvgemucfjqffogffrnfdpggftiffpkfenuceurghilhhouhhtmecuudehtdenucesvcftvggtihhpihgvnhhtshculddquddttddmnecujfgurhephffvvefufffkggfgtgesthfuredttddtjeenucfhrhhomhepfdftrghfrggvlhculfdrucghhihsohgtkhhifdcuoehrjhifsehrjhifhihsohgtkhhirdhnvghtqeenucggtffrrghtthgvrhhnpeffffffkefgheehffelteeiveeffeevhfelteejvddvieejjeelvdeiheeuveeuffenucfkphepudelhedrudefiedrudelrdelgeenucevlhhushhtvghrufhiiigvpedtnecurfgrrhgrmhepihhnvghtpeduleehrddufeeirdduledrleegpdhhvghlohepkhhrvggrtghhvghrrdhlohgtrghlnhgvthdpmhgrihhlfhhrohhmpedftfgrfhgrvghlucflrdcuhgihshhotghkihdfuceorhhjfiesrhhjfiihshhotghkihdrnhgvtheqpdhnsggprhgtphhtthhopeejpdhrtghpthhtoheplhhinhhugidqphhmsehvghgvrhdrkhgvrhhnvghlrdhorhhgpdhrtghpthhtohepshhrihhnihhvrghsrdhprghnughruhhvrggurgeslhhinhhugidrihhnthgvlhdrtghomhdprhgtphhtthhopegurghnihgvlhdrlhgviigtrghnoheslhhinhgrrhhordhorhhgpdhrtghpthhtoheprhhuihdriihhrghnghesihhnthgvlhdrtghomhdprhgtphht thhopehlihhnuhigqdgrtghpihesvhhgvghrrdhkvghrnhgvlhdrohhrghdprhgtphhtthhopehlihhnuhigqdhkvghrnhgvlhesvhhgvghrrdhkvghrnhgvlhdrohhrgh X-DCC--Metrics: v370.home.net.pl 1024; Body=7 Fuz1=7 Fuz2=7 X-Spam-Status: No, score=-1.9 required=5.0 tests=BAYES_00, RCVD_IN_DNSWL_BLOCKED,SPF_HELO_NONE,SPF_PASS,T_SCC_BODY_TEXT_LINE 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: <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 (snail.vger.email [0.0.0.0]); Fri, 08 Dec 2023 11:21:09 -0800 (PST) X-getmail-retrieved-from-mailbox: INBOX X-GMAIL-THRID: 1784742695489552401 X-GMAIL-MSGID: 1784742695489552401 |
Series |
thermal: core: Remove thermal zones during unregistration
|
|
Message
Rafael J. Wysocki
Dec. 8, 2023, 7:11 p.m. UTC
Hi All, This patch series adds a mechanism to guarantee that thermal_zone_device_unregister() will not return until all of the active references to the thermal zone device object in question have been dropped and it has been deleted (patch [1/3]). This supersedes the approach used so far in which all thermal zone sysfs attribute callbacks check if the zone device is still registered under the zone lock, so as to return early if that is not the case, as it means that device_del() has been called for the thermal zone in question (and returned). It is not necessary to do that any more after patch [1/3], so patch [2/3] removes those checks from the code and drops zone locking that is not necessary any more either. Patch [3/3] uses the observation that the thermal subsystem does not need to check if a thermal zone device is registered at all, because it can use its own data to determine whether or not the thermal zone is going away and so it may not be worth updating it, for example. Please refer to the patch changelogs for details. The series depends on new thermal material in linux-next, but it should not substantially depend on any changes that have not made it into linux-next yet. Thanks!
Comments
Hi Rafael, On 12/8/23 19:11, Rafael J. Wysocki wrote: > Hi All, > > This patch series adds a mechanism to guarantee that > thermal_zone_device_unregister() will not return until all of the active > references to the thermal zone device object in question have been dropped > and it has been deleted (patch [1/3]). > > This supersedes the approach used so far in which all thermal zone sysfs > attribute callbacks check if the zone device is still registered under the > zone lock, so as to return early if that is not the case, as it means that > device_del() has been called for the thermal zone in question (and returned). > It is not necessary to do that any more after patch [1/3], so patch [2/3] > removes those checks from the code and drops zone locking that is not > necessary any more either. > > Patch [3/3] uses the observation that the thermal subsystem does not need to > check if a thermal zone device is registered at all, because it can use its > own data to determine whether or not the thermal zone is going away and so > it may not be worth updating it, for example. > > Please refer to the patch changelogs for details. > > The series depends on new thermal material in linux-next, but it should not > substantially depend on any changes that have not made it into linux-next yet. > > Thanks! > > > I like the concept with completion thing for this. I have tired to stress test these patches with my mock thermal zone module load/unload and it works good. The test was doing the these bits: for i in $(seq 1 1000000) ; do cat /sys/class/thermal/thermal_zone2/trip_point_0_temp > /dev/null 2>&1 ; done & for i in $(seq 1 10000) ; do insmod /data/selftest_ipa.ko ; rmmod selftest_ipa ; done & I couldn't trigger any issues in reading from this trip temp file in background, which should go now w/o the locking. I thought it would be nice test, since we have direct call to trips array 'tz->trips[trip_id].temperature'. Let me know if you think about other scenario for stress testing it. (I have also checked the 'temp' sysfs read, where the mutex for tz is used - also no issues). Feel free to add to all patches: Reviewed-and-tested-by: Lukasz Luba <lukasz.luba@arm.com> Regards, Lukasz
Hi Lukasz, On Mon, Dec 11, 2023 at 2:37 PM Lukasz Luba <lukasz.luba@arm.com> wrote: > > Hi Rafael, > > On 12/8/23 19:11, Rafael J. Wysocki wrote: > > Hi All, > > > > This patch series adds a mechanism to guarantee that > > thermal_zone_device_unregister() will not return until all of the active > > references to the thermal zone device object in question have been dropped > > and it has been deleted (patch [1/3]). > > > > This supersedes the approach used so far in which all thermal zone sysfs > > attribute callbacks check if the zone device is still registered under the > > zone lock, so as to return early if that is not the case, as it means that > > device_del() has been called for the thermal zone in question (and returned). > > It is not necessary to do that any more after patch [1/3], so patch [2/3] > > removes those checks from the code and drops zone locking that is not > > necessary any more either. > > > > Patch [3/3] uses the observation that the thermal subsystem does not need to > > check if a thermal zone device is registered at all, because it can use its > > own data to determine whether or not the thermal zone is going away and so > > it may not be worth updating it, for example. > > > > Please refer to the patch changelogs for details. > > > > The series depends on new thermal material in linux-next, but it should not > > substantially depend on any changes that have not made it into linux-next yet. > > > > Thanks! > > > > > > > > I like the concept with completion thing for this. > I have tired to stress test these patches with my mock > thermal zone module load/unload and it works good. > > The test was doing the these bits: > for i in $(seq 1 1000000) ; do cat > /sys/class/thermal/thermal_zone2/trip_point_0_temp > /dev/null 2>&1 ; done & > for i in $(seq 1 10000) ; do insmod /data/selftest_ipa.ko ; rmmod > selftest_ipa ; done & > > I couldn't trigger any issues in reading from this > trip temp file in background, which should go now w/o the > locking. I thought it would be nice test, since we have > direct call to trips array 'tz->trips[trip_id].temperature'. > Let me know if you think about other scenario for stress testing it. > (I have also checked the 'temp' sysfs read, where the mutex for > tz is used - also no issues). > > Feel free to add to all patches: > > Reviewed-and-tested-by: Lukasz Luba <lukasz.luba@arm.com> Thank you!