Received: by 2002:a05:7412:da14:b0:e2:908c:2ebd with SMTP id fe20csp914233rdb; Sat, 7 Oct 2023 04:35:00 -0700 (PDT) X-Google-Smtp-Source: AGHT+IEQsApIRVGfwJy3Rc1Z6ur2C4PgsZVW/wZL+rdoVA13bOqrDpZB+1sFoVgIp77q2BGpC7x7 X-Received: by 2002:aa7:8889:0:b0:691:1eb:7dda with SMTP id z9-20020aa78889000000b0069101eb7ddamr11258025pfe.7.1696678499638; Sat, 07 Oct 2023 04:34:59 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1696678499; cv=none; d=google.com; s=arc-20160816; b=VVjDJQ5DVyTYSBO+87xO4qamFSwf85TvJA8WB2MkV+NdZn5WkMIPIirzml7Iv+SX4Z TRkXBDXm8zAZ2wVAFF0O3anqb9ABI5n0ooeSjB3s4mu0fl1Im24dwcqPeu3KERmoP4KV Mbf4jOc0lGLw8neX8wQ/cEBQTKNflzPDJFc48GdnZthfh769j7kuKU+exPM0xq0M/gLL OdHLs2rQwCGm6y3Q8aP3W8Ylx1vtqDS5xEo5FWbLQ8gjcsqaDFQhCq72ZR3nEdvtOHuo iKdKXR3v5gJkFG5ghMm78VWAQu16a8CLPOgkIT5cY8NVYzGfUPExFihi+3KRhgL/WVl3 XObg== 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=ZE86UMKJeU52dyZHCGRwDD6gAcMF5ConRr1/EzeAsOU=; fh=5OBIUCw4znRZzzo1fNLLIKs/qNmPBukD41q/q7SVSTQ=; b=pBt/Ozoa1OoIO/6fKUaMVByA8LeIBIgUaw0KA5elivGvamruKPrT7PC/iPpG16pj7K fjJHa9Zi8VczFlSmDHLhsSZIROlbPsl+VLNjBNLue49BaT+b50s7/MzBjE+8Wc+5MAdU 7jdzSWx0Pj+fLtsyJlhZfAHLAyXVRaJsUWYtbJPvsjFefneC+luwjNSN+Ze6EVvmuPYZ rrZzPFYHrZbPp/euEz5f57V7YeM3XWZ4Qo4AKExKN/MzmlfOZOY8Dd4sjg9gUT1Asga0 tgkhYJb3FI5pHYMabmJkLi/8JE6+WuTcH8fxi+bYYGjxSWspc+vHEjdagwdnEMwkd70g QRZA== 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:4 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from howler.vger.email (howler.vger.email. [2620:137:e000::3:4]) by mx.google.com with ESMTPS id s22-20020a63af56000000b00585a45417b3si5461086pgo.129.2023.10.07.04.34.59 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sat, 07 Oct 2023 04:34:59 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:4 as permitted sender) client-ip=2620:137:e000::3:4; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:4 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 howler.vger.email (Postfix) with ESMTP id C2DE980C7131; Sat, 7 Oct 2023 04:34:56 -0700 (PDT) X-Virus-Status: Clean X-Virus-Scanned: clamav-milter 0.103.10 at howler.vger.email Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1343884AbjJGLen (ORCPT + 99 others); Sat, 7 Oct 2023 07:34:43 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:54816 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S233662AbjJGLem (ORCPT ); Sat, 7 Oct 2023 07:34:42 -0400 Received: from cloudserver094114.home.pl (cloudserver094114.home.pl [79.96.170.134]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 04532FA; Sat, 7 Oct 2023 04:34:38 -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 9c1dd8458e715ef9; Sat, 7 Oct 2023 13:34:36 +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 D356B6621FA; Sat, 7 Oct 2023 13:34:35 +0200 (CEST) From: "Rafael J. Wysocki" To: Linux PM Cc: Daniel Lezcano , Linux ACPI , LKML , "Rafael J. Wysocki" , Srinivas Pandruvada , Zhang Rui Subject: [PATCH v1] thermal: trip: Remove lockdep assertion from for_each_thermal_trip() Date: Sat, 07 Oct 2023 13:34:35 +0200 Message-ID: <2709769.mvXUDI8C0e@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: gggruggvucftvghtrhhoucdtuddrgedvkedrgeelgdegudcutefuodetggdotefrodftvfcurfhrohhfihhlvgemucfjqffogffrnfdpggftiffpkfenuceurghilhhouhhtmecuudehtdenucesvcftvggtihhpihgvnhhtshculddquddttddmnecujfgurhephffvvefufffkggfgtgesthfuredttddtjeenucfhrhhomhepfdftrghfrggvlhculfdrucghhihsohgtkhhifdcuoehrjhifsehrjhifhihsohgtkhhirdhnvghtqeenucggtffrrghtthgvrhhnpeffffffkefgheehffelteeiveeffeevhfelteejvddvieejjeelvdeiheeuveeuffenucfkphepudelhedrudefiedrudelrdelgeenucevlhhushhtvghrufhiiigvpedtnecurfgrrhgrmhepihhnvghtpeduleehrddufeeirdduledrleegpdhhvghlohepkhhrvggrtghhvghrrdhlohgtrghlnhgvthdpmhgrihhlfhhrohhmpedftfgrfhgrvghlucflrdcuhgihshhotghkihdfuceorhhjfiesrhhjfiihshhotghkihdrnhgvtheqpdhnsggprhgtphhtthhopeejpdhrtghpthhtoheplhhinhhugidqphhmsehvghgvrhdrkhgvrhhnvghlrdhorhhgpdhrtghpthhtohepuggrnhhivghlrdhlvgiitggrnhhosehlihhnrghrohdrohhrghdprhgtphhtthhopehlihhnuhigqdgrtghpihesvhhgvghrrdhkvghrnhgvlhdrohhrghdprhgtphhtthhopehlihhnuhigqdhkvghrnhgvlhesvhhgvghrrdhkvghrnhgvlhdrohhrghdprhgtphhtthho pehrrghfrggvlheskhgvrhhnvghlrdhorhhgpdhrtghpthhtohepshhrihhnihhvrghsrdhprghnughruhhvrggurgeslhhinhhugidrihhnthgvlhdrtghomh X-DCC--Metrics: v370.home.net.pl 1024; Body=7 Fuz1=7 Fuz2=7 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 howler.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 (howler.vger.email [0.0.0.0]); Sat, 07 Oct 2023 04:34:57 -0700 (PDT) X-Spam-Level: ** From: Rafael J. Wysocki The lockdep assertion in for_each_thermal_trip() was added to possibly catch incorrect usage of that function without the thermal zone lock. However, it turns out that the ACPI thermal driver has a legitimate reason to call for_each_thermal_trip() without locking. Namely, it is called by acpi_thermal_bind_unbind_cdev() in the thermal zone registration and unregistration paths. That function cannot acquire the thermal zone lock by itself, because it calls functions that acquire it, thermal_bind_cdev_to_trip() or thermal_unbind_cdev_from_trip(). However, it is invoked when the ACPI notify handler for the thermal zone in question has not been registered yet (in the registration path) or after that handler has been unregistered (in the unregistration path). Therefore, when for_each_thermal_trip() is called by acpi_thermal_bind_unbind_cdev(), thermal trip changes induced by the platform firmware cannot take place and so the thermal zone's trips[] table is effectively immutable. Hence, it is valid to call for_each_thermal_trip() from acpi_thermal_bind_unbind_cdev() without locking and the lockdep assertion in the former is in fact incorrect, so remove it. Fixes: d5ea889246b1 ("ACPI: thermal: Do not use trip indices for cooling device binding") Signed-off-by: Rafael J. Wysocki --- drivers/thermal/thermal_trip.c | 2 -- 1 file changed, 2 deletions(-) Index: linux-pm/drivers/thermal/thermal_trip.c =================================================================== --- linux-pm.orig/drivers/thermal/thermal_trip.c +++ linux-pm/drivers/thermal/thermal_trip.c @@ -15,8 +15,6 @@ int for_each_thermal_trip(struct thermal { int i, ret; - lockdep_assert_held(&tz->lock); - for (i = 0; i < tz->num_trips; i++) { ret = cb(&tz->trips[i], data); if (ret)