Received: by 2002:a05:7412:8d10:b0:f3:1519:9f41 with SMTP id bj16csp3977143rdb; Mon, 11 Dec 2023 05:45:42 -0800 (PST) X-Google-Smtp-Source: AGHT+IFYeW5mjrT+VXLGKb3WKbuypkg5jzQDAYwLhciKDbYKCYrULloMlDZ9rJA49Mq0IC7FrjjR X-Received: by 2002:a92:b05:0:b0:35d:7179:3e71 with SMTP id b5-20020a920b05000000b0035d71793e71mr5727380ilf.127.1702302342496; Mon, 11 Dec 2023 05:45:42 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1702302342; cv=none; d=google.com; s=arc-20160816; b=iaRhUiGo1dGCtyxgurlhkfEytwoAycgjAtN8/W3Iy9HZvQ5ZNqumZA6bZfUbgWDRn5 3kG+p33UAGggj27qHrAUkRTNHWmrTwZ/+he5O6/FwYQFbZaUHKR9PvFs0iKUzMRxebJ5 4cgYtH5kcKEdSSHSt/Kl/xXkskAdK4YkSRaO7/NvR1lhBn7WmYD2k+phpdjppSiyEIlj 0hOfJHkI1SgSKnHL5RsLAFX+Qb8Cj4/SVpnyrDXi+QP2fSLpo0KE3uY1dzFwO5deLutK evAOATrr1kpNwPjghwp8TueUCEkk6hETxGZ5ania1XEOVmBV8eriKIH0qm8rbj56shnU SC5A== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:cc:to:subject :message-id:date:from:in-reply-to:references:mime-version; bh=xB4NOqCYNSFMND5MwaSA4OHsVmqNjVK2LU566wQe7Js=; fh=+11RzK2HwM/csbO+0+4bopHgvW31PubhziQ/7jFTPzI=; b=iji68ZVzfoQ88aj3IjXTZ7cN3mP+9Y0vdGOSt9rwuwh365OisJkBuRLGx5GgRxxbqD el+TxuU24HzbcRzUzfmbrzgszfxE4g9UGwHFUKc72jtPStKxVRls11yltLVxN5AssRRw xdodHVoWLGKytkx6sb3RgqqkaQMYPVx+nVZzocFT1dvSBi+wBSaZdK64ppr8SDegnlRN wPiHoJys7WnaN+mqQFk78oaUMyeKZk7Fz/yRNTkYyokxGjdoRiopY34hZlEqsQdSuX+Y KALjxZ8aGYyehu8HgvlvYxSEAFTOas/9PklCXnwVA855Zd7DmtpE2xmHSMpHlOjqP4DR /igQ== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.36 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Return-Path: Received: from pete.vger.email (pete.vger.email. [23.128.96.36]) by mx.google.com with ESMTPS id b21-20020a63eb55000000b005c220a94525si6050234pgk.90.2023.12.11.05.45.42 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 11 Dec 2023 05:45:42 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.36 as permitted sender) client-ip=23.128.96.36; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.36 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Received: from out1.vger.email (depot.vger.email [IPv6:2620:137:e000::3:0]) by pete.vger.email (Postfix) with ESMTP id 3B5B7808724C; Mon, 11 Dec 2023 05:45:27 -0800 (PST) X-Virus-Status: Clean X-Virus-Scanned: clamav-milter 0.103.11 at pete.vger.email Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1343631AbjLKNpD convert rfc822-to-8bit (ORCPT + 99 others); Mon, 11 Dec 2023 08:45:03 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:56850 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S234350AbjLKNpC (ORCPT ); Mon, 11 Dec 2023 08:45:02 -0500 Received: from mail-ot1-f50.google.com (mail-ot1-f50.google.com [209.85.210.50]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id D8288AD; Mon, 11 Dec 2023 05:45:08 -0800 (PST) Received: by mail-ot1-f50.google.com with SMTP id 46e09a7af769-6da06c505ccso470126a34.1; Mon, 11 Dec 2023 05:45:08 -0800 (PST) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1702302308; x=1702907108; h=content-transfer-encoding:cc:to:subject:message-id:date:from :in-reply-to:references:mime-version:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=JuMgu00NLAwah5dEifMlDlKfcOMiONZuqYgJcIiGOM8=; b=i+iRV5V6qyTFUIOc4PMslxyJAy+OSs2yBAcLez0WBYLvDItzVs79T3W36VxNe0jOXw Xls/vjH+aqV+e/LGYQJO6C3afCf3rg6TaUNmT7BaETe4oHH3KxPnoIQGWLq6qyg7qzTt vOcsb1ygdjozEDkpuc73lFzisQUfqqgA0Eb7rhhYhf9v80aLtgTJyQKY60loI0r0sLQ2 63magvwBUUm7N8BxeJ4AMnTP2AUs0Tc2bAgreEWaS74jSsQenYBooig2qkwVnaNLF4mO OCk6I8lpYO4QOMzp6pAVdqXgcwPi3RYDxhTD27bqL/S2h0GsUX6/yKz3RZfo3xdhA9jc fXbA== X-Gm-Message-State: AOJu0Yxaubv0EP4fZ8nxcdAVhoDmk8qCBbdYfrGYtXjMBSaADU83ApgR dtUIMYWCU5Dnugnzq51ZbKOZQhn9mRhE4kKBIIA= X-Received: by 2002:a05:6870:9607:b0:1fb:23ec:3318 with SMTP id d7-20020a056870960700b001fb23ec3318mr8409458oaq.0.1702302308012; Mon, 11 Dec 2023 05:45:08 -0800 (PST) MIME-Version: 1.0 References: <1880915.tdWV9SEqCh@kreacher> In-Reply-To: From: "Rafael J. Wysocki" Date: Mon, 11 Dec 2023 14:44:51 +0100 Message-ID: Subject: Re: [PATCH v1 0/3] thermal: core: Remove thermal zones during unregistration To: Lukasz Luba Cc: "Rafael J. Wysocki" , Srinivas Pandruvada , Linux PM , Daniel Lezcano , Zhang Rui , Linux ACPI , LKML Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: 8BIT X-Spam-Status: No, score=-1.0 required=5.0 tests=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 pete.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 (pete.vger.email [0.0.0.0]); Mon, 11 Dec 2023 05:45:27 -0800 (PST) Hi Lukasz, On Mon, Dec 11, 2023 at 2:37 PM Lukasz Luba 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 Thank you!