Received: by 2002:a05:6358:11c7:b0:104:8066:f915 with SMTP id i7csp4764382rwl; Tue, 28 Mar 2023 10:59:25 -0700 (PDT) X-Google-Smtp-Source: AKy350a/ztydEhMRmM7yxmlJLK0oyVS0DuJLg1c2k4k8Qcx2Lncvd0/CzNOWIKDGVpSkHdVrNhgC X-Received: by 2002:a17:90b:4c12:b0:234:1a60:a6b0 with SMTP id na18-20020a17090b4c1200b002341a60a6b0mr18911329pjb.34.1680026365366; Tue, 28 Mar 2023 10:59:25 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1680026365; cv=none; d=google.com; s=arc-20160816; b=ByOmvqXLbEfyYgA5u4aHb7XkiKZqEPmkad/j26HXhA3jcOk6V0+RMTk5XZxfmiHP5I Hslpc1dW9Hey8e+OggldrFmagnprsKEh/ca64IaqvuYSnZWrmMpvPf5qeKrSSDoDmvR/ /hpasnsXE1kS79COjtCtfyOc1C2j99YxzaKEFsEk6hmLhhq3ZMjj5qx/9nbYVVcCq6CV pH1P2CvBwlCC9opNXWOpBxNB0NfaEdPtrZmKO0rJaGNWSiMCs38+qAlMvshNzR9geJaB zQD+1IkcmslzW8yT0IjNtxluiHQEcT0k8wJaqBdtkod6NkbZ6aKDAdQ6EzjHBHYTwBcE 5TCQ== 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=EL8V99HmVIapw+IcprpiCF/TUjFUwe4VQH4N8wuLWlo=; b=fqeoaDW8j1e0lUpi4IGaBAZCuXWmJV/M24aKyKW70PbfpMYq6pyjaQ8eui7yZGtuLE OvXhIeyBiDZtTmT94sN7kYY6FuixG4gURSBdo5/a/J5WhrJZyN8VHsvZQv+M0fkAviql L4358sSD5A1zos2AaXiVqkFWLme62YqtXmVLzlmcM3vETxdRFdBEZI6DsdJ4xzo0GoTC y2jSod6mPSCZgrKeSwMidVrHGkj4K1hS7hSvddjGtDtoo6yYC8NRmbt62DwSCKIa+27N aD3RISboQl5tQbzXkbaZYGHGRy0TMlBQOAf+JIRNemXv9Jel/iA0ipdC/kP67qZjk6va xIrQ== 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 ju3-20020a170903428300b001a0492c419csi28920851plb.523.2023.03.28.10.59.13; Tue, 28 Mar 2023 10:59:25 -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; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229841AbjC1RzN convert rfc822-to-8bit (ORCPT + 99 others); Tue, 28 Mar 2023 13:55:13 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:41798 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229837AbjC1RzM (ORCPT ); Tue, 28 Mar 2023 13:55:12 -0400 Received: from mail-ed1-f44.google.com (mail-ed1-f44.google.com [209.85.208.44]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 16786114; Tue, 28 Mar 2023 10:55:06 -0700 (PDT) Received: by mail-ed1-f44.google.com with SMTP id eg48so52975483edb.13; Tue, 28 Mar 2023 10:55:06 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; t=1680026104; 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=zM4djXyeY54M5VkLAl8JUHt2hpd0bXhVxLFdkufkV9o=; b=UtAKrpjz7YFvGG2TbaA2Pttf9zL9cU5gYd81nieRUFGJrO9ZQlh0dNZp7AVWfwpNUv 3Nv9+inVC57pHb2AeLNnPN0PoVn/Pc7+GfoFuBJNpqIQIk907EIwxstRKa9KpzOtw+Nw 2+VXCHq5RlurmFjUqCby6bMKgd4Zzuf4gJ4YMC1mIV43ZSaztt21rblB4ndBjUPxLCiF Fobn4dkPjVZBHX77imJCE1kHbl2X2R4oB5FVGVtYqdCLxkV9g5+oKGYHQ//gC+tDT/t7 n5kpqZ9c4ADXPZstzaPKybkLzxK33d9KFab+2rnn8B8pMkTmVnvD2u8BMaqY0NCY5qoD 05pg== X-Gm-Message-State: AAQBX9eDopD51t4OSAtmHJiKvJiXKumSQzJBGa0CUTmjM3sYz7d7PSYT bSb6QAs0CeyvIkZ/wqVKs76ATUaTkIvdzYMzr7Q= X-Received: by 2002:a17:907:d02:b0:931:6921:bdbb with SMTP id gn2-20020a1709070d0200b009316921bdbbmr7903400ejc.2.1680026104457; Tue, 28 Mar 2023 10:55:04 -0700 (PDT) MIME-Version: 1.0 References: <20230324070807.6342-1-rui.zhang@intel.com> <20230324070807.6342-2-rui.zhang@intel.com> <528f7e58507df4b6137856828e371bb8913b8b59.camel@intel.com> In-Reply-To: From: "Rafael J. Wysocki" Date: Tue, 28 Mar 2023 19:54:53 +0200 Message-ID: Subject: Re: [PATCH 2/5] thermal/core: Reset cooling state during cooling device unregistration To: "Zhang, Rui" Cc: "rafael@kernel.org" , "linux-pm@vger.kernel.org" , "Wysocki, Rafael J" , "daniel.lezcano@linaro.org" , "linux-kernel@vger.kernel.org" Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: 8BIT X-Spam-Status: No, score=0.5 required=5.0 tests=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 Tue, Mar 28, 2023 at 4:46 AM Zhang, Rui wrote: > > On Mon, 2023-03-27 at 17:13 +0200, Rafael J. Wysocki wrote: > > On Mon, Mar 27, 2023 at 4:50 PM Zhang, Rui > > wrote: > > > On Fri, 2023-03-24 at 14:19 +0100, Rafael J. Wysocki wrote: > > > > On Fri, Mar 24, 2023 at 8:08 AM Zhang Rui > > > > wrote: > > > > > When unregistering a cooling device, it is possible that the > > > > > cooling > > > > > device has been activated. And once the cooling device is > > > > > unregistered, > > > > > no one will deactivate it anymore. > > > > > > > > > > Reset cooling state during cooling device unregistration. > > > > > > > > > > Signed-off-by: Zhang Rui > > > > > --- > > > > > In theory, this problem that this patch fixes can be triggered > > > > > on a > > > > > platform with ACPI Active cooling, by > > > > > 1. overheat the system to trigger ACPI active cooling > > > > > 2. unload ACPI fan driver > > > > > 3. check if the fan is still spinning > > > > > But I don't have such a system so I didn't trigger then problem > > > > > and > > > > > I > > > > > only did build & boot test. > > > > > > > > So I'm not sure if this change is actually safe. > > > > > > > > In the example above, the system will still need the fan to spin > > > > after > > > > the ACPI fan driver is unloaded in order to cool down, won't it? > > > > > > Then we can argue that the ACPI fan driver should not be unloaded > > > in > > > this case. > > > > I don't think that whether or not the driver is expected to be > > unloaded at a given time has any bearing on how it should behave when > > actually unloaded. > > > > Leaving the cooling device in its current state is "safe" from the > > thermal control perspective, but it may affect the general user > > experience (which may include performance too) going forward, so > > there > > is a tradeoff. > > Right. > If we don't have a third choice, then the question is simple. > "thermal safety" vs. "user experience"? > > I'd vote for "thermal safety" and drop this patch series. Works for me. > > What do the other cooling device drivers do in general when they get > > removed? > > No cooling device driver has extra handling after cdev unregistration. However, the question regarding what to do when the driver of a cooling device in use is being removed is a valid one. One possible approach that comes to mind could be to defer the driver removal until the overheat condition goes away, but anyway it would be better to do that in the core IMV.