Message ID | 21958338.EfDdHjke4D@kreacher |
---|---|
State | New |
Headers |
Return-Path: <linux-kernel-owner@vger.kernel.org> Delivered-To: ouuuleilei@gmail.com Received: by 2002:a59:c923:0:b0:3e4:2afc:c1 with SMTP id j3csp1945245vqt; Tue, 18 Jul 2023 11:57:56 -0700 (PDT) X-Google-Smtp-Source: APBJJlF+oKyixfjriDlrINDxVFwpumJbtHeuLAyv+4e3R32hQJsC+Czw9WGLoL7Kp9gwTrnpEYEo X-Received: by 2002:a05:6a20:7f85:b0:132:ef90:1d1d with SMTP id d5-20020a056a207f8500b00132ef901d1dmr387992pzj.0.1689706675866; Tue, 18 Jul 2023 11:57:55 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1689706675; cv=none; d=google.com; s=arc-20160816; b=vyUHSLd+I4Oi7eY1czuRydTdv3004ByfizYHu5Q3jESNbGhhnwA0QjHrnBq/UAWmrE rggalamaZjnnTQA7sdkA/wddlQt3Pw4PXlrW45hPV79oWo/0lRBmTXTofKP5vPCTSEVz Ff5G7cSG4ZQ3pyWOSPe/oeGrhOnRSrGpaGJd+5BJIuFwyinJKy3sDO/MR+SweloJGR1L 10f9+AXP/zYAUKca47wbLCpB/YRvStETH7/z31hhAS6BQYR55vvBX5lyL8g8pcxKJxIA f7JftB4w2scWgSqRMLcf4NH9lQi0gzsIQbhTVjwxNvv3lPsEWlEDSq+wolQ57CZEuIps 4BXQ== 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 :references:in-reply-to:message-id:date:subject:cc:to:from; bh=RqsLgAHG1ElqV+YrLiaoxgDR9kem7XP2SXh6iE4duBw=; fh=WAm0nkxw3rD71A4QzwJS1JiPPKRsyn91IiWMPsOrzoY=; b=B1a4nOaZT3lsXboFE34g9Hwc6q0M7UGggRNBFMlO/hN8ox30WIU7qjrHA+rTm7fLgF dP557mAq9U8O5gUu7M75C2O3cUBkKNk8IeuAEdnNQzgQXoxxMuGzTOEhVGSaFo3D613u V8Ca9PlBDfMZbbPkd7lqztl75ELmUxsVYVoDvZCMoMMz9AFqHXT4nKuTW/3Jk5pZYBdq /9R1EHQBpWxuZN3ANm3NIQhi7qtXZZOinBMoyHhuLBT7ypAd+6/RJZf11Y1/qYyYvEmC uTmWMd4+FENv7AvAq/Tn4vqHQzrmFmRqPHJZjH5kbTeRZ/gnVBVXSjnKYxSuDB1KYcL3 QGbA== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id f3-20020a637543000000b0056337aa2f06si1645546pgn.527.2023.07.18.11.57.41; Tue, 18 Jul 2023 11:57:55 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229796AbjGRSVm (ORCPT <rfc822;assdfgzxcv4@gmail.com> + 99 others); Tue, 18 Jul 2023 14:21:42 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:55024 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229536AbjGRSVe (ORCPT <rfc822;linux-kernel@vger.kernel.org>); Tue, 18 Jul 2023 14:21:34 -0400 Received: from cloudserver094114.home.pl (cloudserver094114.home.pl [79.96.170.134]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 81D7BFD; Tue, 18 Jul 2023 11:21:27 -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 1abb4fa41606034e; Tue, 18 Jul 2023 20:21:26 +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 86FC26614F7; Tue, 18 Jul 2023 20:21:25 +0200 (CEST) From: "Rafael J. Wysocki" <rjw@rjwysocki.net> To: Linux ACPI <linux-acpi@vger.kernel.org> Cc: LKML <linux-kernel@vger.kernel.org>, Linux PM <linux-pm@vger.kernel.org>, Michal Wilczynski <michal.wilczynski@intel.com>, Zhang Rui <rui.zhang@intel.com>, Srinivas Pandruvada <srinivas.pandruvada@linux.intel.com>, Daniel Lezcano <daniel.lezcano@linaro.org> Subject: [PATCH v1 4/7] ACPI: thermal: Hold thermal_check_lock around trip updates Date: Tue, 18 Jul 2023 20:06:02 +0200 Message-ID: <21958338.EfDdHjke4D@kreacher> In-Reply-To: <13318886.uLZWGnKmhe@kreacher> References: <13318886.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: gggruggvucftvghtrhhoucdtuddrgedviedrgeeggdduudelucetufdoteggodetrfdotffvucfrrhhofhhilhgvmecujffqoffgrffnpdggtffipffknecuuegrihhlohhuthemucduhedtnecusecvtfgvtghiphhivghnthhsucdlqddutddtmdenucfjughrpefhvfevufffkfgjfhgggfgtsehtufertddttdejnecuhfhrohhmpedftfgrfhgrvghlucflrdcuhgihshhotghkihdfuceorhhjfiesrhhjfiihshhotghkihdrnhgvtheqnecuggftrfgrthhtvghrnhepvdffueeitdfgvddtudegueejtdffteetgeefkeffvdeftddttdeuhfegfedvjefhnecukfhppeduleehrddufeeirdduledrleegnecuvehluhhsthgvrhfuihiivgeptdenucfrrghrrghmpehinhgvthepudelhedrudefiedrudelrdelgedphhgvlhhopehkrhgvrggthhgvrhdrlhhotggrlhhnvghtpdhmrghilhhfrhhomhepfdftrghfrggvlhculfdrucghhihsohgtkhhifdcuoehrjhifsehrjhifhihsohgtkhhirdhnvghtqedpnhgspghrtghpthhtohepjedprhgtphhtthhopehlihhnuhigqdgrtghpihesvhhgvghrrdhkvghrnhgvlhdrohhrghdprhgtphhtthhopehlihhnuhigqdhkvghrnhgvlhesvhhgvghrrdhkvghrnhgvlhdrohhrghdprhgtphhtthhopehlihhnuhigqdhpmhesvhhgvghrrdhkvghrnhgvlhdrohhrghdprhgtphhtthhopehmihgthhgrlhdrfihilhgtiiihnhhskhhisehinhhtvghlrdgtohhmpdhr tghpthhtoheprhhuihdriihhrghnghesihhnthgvlhdrtghomhdprhgtphhtthhopehsrhhinhhivhgrshdrphgrnhgurhhuvhgruggrsehlihhnuhigrdhinhhtvghlrdgtohhm 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-getmail-retrieved-from-mailbox: INBOX X-GMAIL-THRID: 1771785867653956328 X-GMAIL-MSGID: 1771785867653956328 |
Series |
ACPI: thermal: Use trip point table to register thermal zones
|
|
Commit Message
Rafael J. Wysocki
July 18, 2023, 6:06 p.m. UTC
From: Rafael J. Wysocki <rafael.j.wysocki@intel.com> There is a race condition between acpi_thermal_trips_update() and acpi_thermal_check_fn(), because the trip points may get updated while the latter is running which in theory may lead to inconsistent results. For example, if two trips are updated together, using the temperature value of one of them from before the update and the temperature value of the other one from after the update may not lead to the expected outcome. To address this, make acpi_thermal_trips_update() hold thermal_check_lock across the entire update of trip points. Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com> --- drivers/acpi/thermal.c | 4 ++++ 1 file changed, 4 insertions(+)
Index: linux-pm/drivers/acpi/thermal.c =================================================================== --- linux-pm.orig/drivers/acpi/thermal.c +++ linux-pm/drivers/acpi/thermal.c @@ -193,6 +193,8 @@ static int acpi_thermal_trips_update(str struct acpi_handle_list devices; bool valid = false; int i; + + mutex_lock(&tz->thermal_check_lock); /* Critical Shutdown */ if (flag & ACPI_TRIPS_CRITICAL) { @@ -395,6 +397,8 @@ static int acpi_thermal_trips_update(str } } + mutex_unlock(&tz->thermal_check_lock); + return 0; }