Received: by 2002:a05:6358:a55:b0:ec:fcf4:3ecf with SMTP id 21csp1394205rwb; Thu, 19 Jan 2023 10:02:06 -0800 (PST) X-Google-Smtp-Source: AMrXdXvEPS1HqCLNf5p4xkK9Hf5iwYEyg08u7zzkn49/+NMcsy+AT1s1rNTKvBSFtfAAY9KIkhyb X-Received: by 2002:a17:906:f218:b0:870:e823:c07 with SMTP id gt24-20020a170906f21800b00870e8230c07mr13313327ejb.2.1674151326085; Thu, 19 Jan 2023 10:02:06 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1674151326; cv=none; d=google.com; s=arc-20160816; b=aa4CyiCtctoA8786PISI9HQ7678pXsa70Oh1kH2QtNb59EBUngDaHKhYXM1nGQd0lO XTNGREp2vCxpNCxNrQhIx094yOJUsN4dDZavE2+6ZcYIsHYQUlqByw9ogq8cJcEAIKVW jm1ASUOXle0xBFvafu2zIOoCYdWAeB3+DZg3hHc27gJ3hrLG1RO0alL6UwgswGsFYgVk 10Jg3z7VS0hCVUUyUAqxmLjw/2PvEImWTgQnvo41OE8yHuI/Daar42YC05hy0QVHhDHH 0INY2ThdO0+4xGGJjVqlf7/zmI5iOnf0ehLLKywc1lNpPPMwq6p0iroPeCOPJAciUwU9 WXtA== 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=bxFKReXhiNeHH0B2c67HXt8d1FtZifP9bV42iFW5m6I=; b=UxAdzMhhil+af2ZD3AvMdzUXkXjTZaHnhU9WvrlbmZBxnOujt8ramUFGteUQMYZK8X vCTXj07kejffipcfaL9P0NVwBc24/lvAi00Vyf5HHTBsnEWypq9PCtjuDE2L+PShzMh9 hfzlDbOfu6lONDyj28eapyquwWojZtWnokltCfBvBVA+ctn+idRyliLR5ATz/pV1wuWZ w1ItUsYgXA9jLXTrxT84wq/lyro1t1frc+VLyOakVTr0Ve/PNJCy0/oBnh6/vTVyriaP im0GNoQG08TW7RrNZIJUOSfK0iOC384MbvIA/h88LtEgIGbwsbjWwtE1FbvDuDRKWmRv ypHw== 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 go20-20020a1709070d9400b00855da26bccasi18757741ejc.974.2023.01.19.10.01.55; Thu, 19 Jan 2023 10:02:06 -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 S230460AbjASRFf (ORCPT + 45 others); Thu, 19 Jan 2023 12:05:35 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:49712 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229885AbjASRFd (ORCPT ); Thu, 19 Jan 2023 12:05:33 -0500 Received: from mail-ed1-f50.google.com (mail-ed1-f50.google.com [209.85.208.50]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 7710B49429; Thu, 19 Jan 2023 09:05:31 -0800 (PST) Received: by mail-ed1-f50.google.com with SMTP id s3so3683280edd.4; Thu, 19 Jan 2023 09:05:31 -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=bxFKReXhiNeHH0B2c67HXt8d1FtZifP9bV42iFW5m6I=; b=OZW/MszGhie0Gi9tNjE6JKtCI/199sBkNPzuxvyA6E7SLK4yyE7znyJIH5+RfYJgQU Bxfa7Q5waJQLoWzTYlYea/czAHD+nGzfUCuqokgO08WfTjS7xPvRuzFQV9Czf9SuP6NP a2uA/FlxmirXk1ISE0x01FM9kGTjTqWglykSSDO3RmrZJs1tl7e4jnNN0OmQABETt3EW j98MrbuWjJbXGG+sDR6TtJQI2xUdN1gsrmLTQjp0MBwr8CAjmyRBQr6/zfr64Qh12RTj Dsi8g/8WavKVqUwuvRhiqw4WwlTo8310MQtEoQgMufJy494Wkw+ZVgat8IkwNmEI+c06 spUA== X-Gm-Message-State: AFqh2krgdielK0M/g8eOgfRVMI/jJUczF6tSK1BsCSYxdKtwgxlgsBOz 7KAMulhyLXdaon/UmX+9a9lKxRwjSaWLBKfYQBM= X-Received: by 2002:a05:6402:4498:b0:495:f184:3971 with SMTP id er24-20020a056402449800b00495f1843971mr1645829edb.95.1674147930000; Thu, 19 Jan 2023 09:05:30 -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> <33bb6a2a6b473d74c73a730671e6bd12c764bcd6.camel@linux.intel.com> In-Reply-To: <33bb6a2a6b473d74c73a730671e6bd12c764bcd6.camel@linux.intel.com> From: "Rafael J. Wysocki" Date: Thu, 19 Jan 2023 18:05:18 +0100 Message-ID: Subject: Re: [PATCH v5 0/3] Thermal ACPI APIs for generic trip points To: srinivas pandruvada Cc: "Rafael J. Wysocki" , Daniel Lezcano , "Zhang, Rui" , "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 5:58 PM srinivas pandruvada wrote: > > On Thu, 2023-01-19 at 13:17 +0100, Rafael J. Wysocki wrote: > > 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? > These trips are read at the start of DTT/Thermald and will be read once > after notification is received. So extremely unlikely. > But we can add the patch before this series to address this issue, > which can be marked stable. I can submit this. Looks reasonable to me.