Received: by 2002:a05:7412:8d10:b0:f3:1519:9f41 with SMTP id bj16csp3972684rdb; Mon, 11 Dec 2023 05:37:29 -0800 (PST) X-Google-Smtp-Source: AGHT+IEdeXgUfqXpIIKAcGsLpol6UGQuRNzxEvMavQhAFcPd+CQeyPX1B0tLQrpZHtqYuRfkypy7 X-Received: by 2002:a17:902:cec3:b0:1d0:cbef:2efd with SMTP id d3-20020a170902cec300b001d0cbef2efdmr2027572plg.21.1702301849532; Mon, 11 Dec 2023 05:37:29 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1702301849; cv=none; d=google.com; s=arc-20160816; b=egZUDsyVgWwyypYYG0rg1aYYgVWdjaB5q9u40A0ZuiF9sDvWIIOmvXwoJHj7hSqRlL 7/DuKtiCLEE+3mAZv1no/SmFgDaoyuT3kK2yYvcMQinyDcpPqX4tGW0WCr2Fan1UlAW/ 7RWO/33jJc+/dHkjixW2pWHlimPrwYBA/luW7DJHi9N/4l2tDDnkMtxC3jsotoPBgiwD FkGQ585Y4tPqFbJhsqZEG1iFiUNoPpY1oaP+7+MyksDiUy4a6xE7mxuL+ocvddKr0OGG TJeslB57gMTzld0DudMBfHMQiK2/rkDIPFOjX42wNoJ4CKnwzVfN8rs5cbv20ypNRfaY n7lg== 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; bh=json6NTlVu62mmemiJkLb0Jfh5GmRV175NnQ3ZIFMNE=; fh=2cYSZm3Au5XFFkwyTn7KsTAN3fE5qH7zF1uLoNtBqBA=; b=galZ1oSEEFJ8gBNN+9Rr50Bp1ZnTqJ2hLyEMkAU4pU+KxteQV2DkYqCBnv/WvYUMtR empSKSlaraGkRN5Z/RjrDY0dFv0m7EJEVx1dQ5hQz+D+kRFTzuRPXej1kV0hjCjPAK4P DOAp3ZhTdn9DOBZzIWgGBeXl0WJbV7fQJD/aI97dyYpC6lbo8B8jBJfcvjIo2ixtjlrJ +PNBYoh8gHGhMhbUVNQwgHPJl+f1oAdJ7fpI3UrSho21umUKWVMhDHap6MQOPmXi8kSj 4PICBbT0VpNRatOnU9bLdEmGm79+Q90a+4kxNAqxLM3SdXzhCiKcxBKtutGErVdLyGXO +v3Q== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:3 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=arm.com Return-Path: Received: from lipwig.vger.email (lipwig.vger.email. [2620:137:e000::3:3]) by mx.google.com with ESMTPS id c7-20020a170902d48700b001cc5ada2b94si6235688plg.366.2023.12.11.05.37.29 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 11 Dec 2023 05:37:29 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:3 as permitted sender) client-ip=2620:137:e000::3:3; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:3 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=arm.com Received: from out1.vger.email (depot.vger.email [IPv6:2620:137:e000::3:0]) by lipwig.vger.email (Postfix) with ESMTP id DC53A8088A61; Mon, 11 Dec 2023 05:37:26 -0800 (PST) X-Virus-Status: Clean X-Virus-Scanned: clamav-milter 0.103.11 at lipwig.vger.email Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1343688AbjLKNhK (ORCPT + 99 others); Mon, 11 Dec 2023 08:37:10 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:48762 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S234453AbjLKNhJ (ORCPT ); Mon, 11 Dec 2023 08:37:09 -0500 Received: from foss.arm.com (foss.arm.com [217.140.110.172]) by lindbergh.monkeyblade.net (Postfix) with ESMTP id B0854CF; Mon, 11 Dec 2023 05:37:14 -0800 (PST) Received: from usa-sjc-imap-foss1.foss.arm.com (unknown [10.121.207.14]) by usa-sjc-mx-foss1.foss.arm.com (Postfix) with ESMTP id D3116FEC; Mon, 11 Dec 2023 05:38:00 -0800 (PST) Received: from [10.57.84.143] (unknown [10.57.84.143]) by usa-sjc-imap-foss1.foss.arm.com (Postfix) with ESMTPSA id 21ECB3F762; Mon, 11 Dec 2023 05:37:12 -0800 (PST) Message-ID: Date: Mon, 11 Dec 2023 13:38:16 +0000 MIME-Version: 1.0 User-Agent: Mozilla Thunderbird Subject: Re: [PATCH v1 0/3] thermal: core: Remove thermal zones during unregistration Content-Language: en-US To: "Rafael J. Wysocki" Cc: Srinivas Pandruvada , Linux PM , Daniel Lezcano , Zhang Rui , Linux ACPI , LKML References: <1880915.tdWV9SEqCh@kreacher> From: Lukasz Luba In-Reply-To: <1880915.tdWV9SEqCh@kreacher> Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 7bit X-Spam-Status: No, score=-0.8 required=5.0 tests=HEADER_FROM_DIFFERENT_DOMAINS, MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS,T_SCC_BODY_TEXT_LINE autolearn=unavailable autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lipwig.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 (lipwig.vger.email [0.0.0.0]); Mon, 11 Dec 2023 05:37:27 -0800 (PST) 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 Regards, Lukasz