Received: by 2002:a05:6358:a55:b0:ec:fcf4:3ecf with SMTP id 21csp912488rwb; Thu, 19 Jan 2023 04:26:25 -0800 (PST) X-Google-Smtp-Source: AMrXdXt9AkSNxSOZFJ+6nPxFOvhRFk6HVa8OXTkM4TFzJzOiZeeRJuFqzLj3ZJQPr7Wz4w+ZL3yy X-Received: by 2002:a17:902:e887:b0:193:e89:f5ff with SMTP id w7-20020a170902e88700b001930e89f5ffmr42566443plg.28.1674131184986; Thu, 19 Jan 2023 04:26:24 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1674131184; cv=none; d=google.com; s=arc-20160816; b=IkSrfg3IsQ3Wv4lMu/3ohvRz1NXny18AFCJO0X+BOADmKsygc1ZM/KhttUU+n9wuRw Sta5ebVuH8bkNBMp8Hcc7ep3KgGEquZaxNoTuYK2CLPG1lDslM8Hzbwc2JgSfNy5Q0cj JSnj9YaTPtxLW3tNP5iVF0S9RtbsJoKxljZaD0zt+i6Gejmzl8XgnKyfxFDBTpicnXSm 12ua+j1u1Ub5e4iz+j8cWvr5JqwhLfDjMrdL8eL32tnN7bIGYJ8KBl+t6QUVziVD2NJ3 7kLCuvXyRYOPoVjmPxLi64FI5e028DnMQtbXUCk4ZQsrqm6z8s/svugLa/YqeYhq2bMF Drdw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:cc:to:subject:message-id:date:from:in-reply-to :references:mime-version; bh=HtpmlB8McVRoQ6HtPysr/zkpr2aEvec+90xBPvPorAE=; b=JGwtXcHktmjb04VPGvjma1wYEK1np/wcAxfVWSJTA00gAreoSGg4YlJVUc0S6Gw56X WPE+/IyIin+pUVFSkNY50gA5odyLWyjbceDYbm27iic2AQQCNh3bA0RKt47h/WSt7BwL oJ1NYeeINST0x9YmuIjKoZSCg3EE9NWNguR+dC8CbG2X/pjN9nySHzfvHVQjAdJ9VHph 5V+DgfICnO60DFV4x1S8art4TmvqnUE4wo/9Oq02HbTicxKBS9tZocxZY4AMWwnXSk+Y oNiwpHbd/hcI7A6QF+KW29CzyYB5AyOmARbAngJMBjpPaWlxzW833IDXR8C33fmgKnu9 h9yQ== 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; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id c18-20020a170902c1d200b0019481337656si14619986plc.0.2023.01.19.04.26.19; Thu, 19 Jan 2023 04:26:24 -0800 (PST) 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; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230269AbjASMSI (ORCPT + 44 others); Thu, 19 Jan 2023 07:18:08 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:44432 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230361AbjASMSA (ORCPT ); Thu, 19 Jan 2023 07:18:00 -0500 Received: from mail-ej1-f43.google.com (mail-ej1-f43.google.com [209.85.218.43]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id C527CC646; Thu, 19 Jan 2023 04:17:42 -0800 (PST) Received: by mail-ej1-f43.google.com with SMTP id rl14so1828589ejb.2; Thu, 19 Jan 2023 04:17:42 -0800 (PST) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=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=HtpmlB8McVRoQ6HtPysr/zkpr2aEvec+90xBPvPorAE=; b=faujHa8O2xrDhMPr9vTVPwGsYj0y+2FQGUnxdsARnU1a39tw+/ho0GUX6hU64gMpc1 EzPbY7SXMdDHmB0o9ksoGPwAstJDY9U7q5noiSI3WL1RQONGpq3FNiY8Y+9KSMP7tfbS w12PmOmx0AXOfTRCH1K2DXDw5r5npYk4No3iarIUIqRnp11qJJd8ZTA+zBdvjxODAwBP pxWCXX61QhAQyjgGdeERvtT6O50i99yHPkVGmDb/EHh+F9FL7+fwf4e9Tm02gd9TTOFI f6qXbO+7yECKq/yTtxddV63TYH8k7WRZyQRbjnq3Ju1hoDk8vXgzZyHhozXv3Jhw6xHh cQDQ== X-Gm-Message-State: AFqh2kqa+fmsZPLSQnpDE9dBmNBmKUabXmICoOReVDRS0eQ+LvZB+thB D8r65+a0pyqJUT81u0YPGHCz2DTG2AdfMKbAMQw= X-Received: by 2002:a17:906:d971:b0:84d:381c:bdaa with SMTP id rp17-20020a170906d97100b0084d381cbdaamr1155247ejb.79.1674130660879; Thu, 19 Jan 2023 04:17:40 -0800 (PST) MIME-Version: 1.0 References: <20230113180235.1604526-1-daniel.lezcano@linaro.org> <2627c37e07dce6b125d3fea3bf38a5f2407ad6a1.camel@intel.com> <5aabdd3010a02e361fbbe01f4af0e30d11f0ae6b.camel@linux.intel.com> <8547963350fb3bdb09a4693f0eb80c7199ab6f21.camel@linux.intel.com> <87627e1f-322c-a195-8ce6-8922d9787ff0@linaro.org> <340f3ecdaddb2c422dcbe3df712a082f333eab0d.camel@linux.intel.com> In-Reply-To: From: "Rafael J. Wysocki" Date: Thu, 19 Jan 2023 13:17:29 +0100 Message-ID: Subject: Re: [PATCH v5 0/3] Thermal ACPI APIs for generic trip points To: srinivas pandruvada Cc: Daniel Lezcano , "Zhang, Rui" , "rafael@kernel.org" , "linux-pm@vger.kernel.org" , "linux-kernel@vger.kernel.org" , "christophe.jaillet@wanadoo.fr" , "linux-acpi@vger.kernel.org" Content-Type: text/plain; charset="UTF-8" X-Spam-Status: No, score=-1.4 required=5.0 tests=BAYES_00, FREEMAIL_FORGED_FROMDOMAIN,FREEMAIL_FROM,HEADER_FROM_DIFFERENT_DOMAINS, RCVD_IN_DNSWL_NONE,RCVD_IN_MSPIKE_H2,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 lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Thu, Jan 19, 2023 at 12:04 AM srinivas pandruvada wrote: > > On Wed, 2023-01-18 at 23:14 +0100, Daniel Lezcano wrote: > > On 18/01/2023 22:16, srinivas pandruvada wrote: > > > On Wed, 2023-01-18 at 22:01 +0100, Daniel Lezcano wrote: > > > > On 18/01/2023 21:53, srinivas pandruvada wrote: > > > > > On Wed, 2023-01-18 at 21:00 +0100, Daniel Lezcano wrote: > > > > > > On 18/01/2023 20:16, srinivas pandruvada wrote: > > > > > > > > > > > > [ ... ] > > > > > > > > > > > > > > > But we'd better wait for the thermald test result from > > > > > > > > > Srinvias. > > > > > > > > > > > > > > > > A quick test show that things still work with thermald > > > > > > > > and > > > > > > > > these > > > > > > > > changes. > > > > > > > > > > > > > > But I have a question. In some devices trip point > > > > > > > temperature > > > > > > > is > > > > > > > not > > > > > > > static. When hardware changes, we get notification. For > > > > > > > example > > > > > > > INT3403_PERF_TRIP_POINT_CHANGED for INT3403 drivers. > > > > > > > Currently get_trip can get the latest changed value. But if > > > > > > > we > > > > > > > preregister, we need some mechanism to update them. > > > > > > > > > > > > When the notification INT3403_PERF_TRIP_POINT_CHANGED > > > > > > happens, we > > > > > > call > > > > > > int340x_thermal_read_trips() which in turn updates the trip > > > > > > points. > > > > > > > > > > > > > > > > Not sure how we handle concurrency here when driver can freely > > > > > update > > > > > trips while thermal core is using trips. > > > > > > > > Don't we have the same race without this patch ? The thermal core > > > > can > > > > call get_trip_temp() while there is an update, no ? > > > Yes it is. But I can add a mutex locally here to solve. > > > But not any longer. > > > > > > I think you need some thermal_zone_read_lock/unlock() in core, > > > which > > > can use rcu. Even mutex is fine as there will be no contention as > > > updates to trips will be rare. > > > > I was planning to provide a thermal_trips_update(tz, trips) and from > > there handle the locking. > > > > As the race was already existing, can we postpone this change after > > the > > generic trip points changes? > I think so. Well, what if this bug is reported by a user and a fix needs to be backported to "stable"? Are we going to backport the whole framework redesign along with it? Or is this extremely unlikely?