Received: by 2002:a05:7412:3b8b:b0:fc:a2b0:25d7 with SMTP id nd11csp486248rdb; Thu, 8 Feb 2024 11:26:44 -0800 (PST) X-Google-Smtp-Source: AGHT+IHLnli+3XXHkuLOuTZyIC6uGZ8OGClHP+tyREg0bCQBOMOUJJHPXswi23KB49jYzzY3iDDN X-Received: by 2002:a0c:dd08:0:b0:686:ab05:59fb with SMTP id u8-20020a0cdd08000000b00686ab0559fbmr275921qvk.8.1707420404359; Thu, 08 Feb 2024 11:26:44 -0800 (PST) ARC-Seal: i=2; a=rsa-sha256; t=1707420404; cv=pass; d=google.com; s=arc-20160816; b=Gjac7/l8NXxEozTEruj0tEo+tDSUlj0B1kKUx91M+G6b0rSFGsMgk7tBYq69r8tVyZ qYqDA36H74XBrNYzt5AsHI3oy+IlhKG8WrpfTarJl3qEu87OzIvYKn8wjg2fBq0paKem vZ2X2cNiSFrnLhgI58ryiiSpcGx6/2XSB75i1PVxdwAE+mphmWXE6q7yGRbkSW2tjPDz vbI0As9j5Ejy7mLqVl6mrqlDuPhN2i615WvR0MORdRe3qBDuoyPLbHJekDaF46RDRp27 Euy3Q5zdGqiqlKQx7AG4dvwniWlX16/S4oGrfZLE8UWqh6Kurnj+ViE2kvKfUGV1Tkzf b5wA== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=content-transfer-encoding:cc:to:subject:message-id:date:from :in-reply-to:references:mime-version:list-unsubscribe:list-subscribe :list-id:precedence; bh=Tb13rhuW8544qF8dDhm649NVENoNwfXmctODywQIT9g=; fh=qMfEE5k8WnXlaCthxHM0gYyp1AkOvMpk+HW8mZ3GqAI=; b=PT7HdVjF/cYZCoKXJfvwSNWD77+IMhdtDEtN46KL3qZ6mSPZ+x4wzTAf+MRAXFwpQ4 3AvKoHEQKnPuOTEKWfYIdn1tb6SZRUQDGZ42gkbdYGKM5ixDpn3yhF8Cga//1vA8lEWc Zq3I+ZDwRqyc4H4DE95h6sRIsRM/voIeJP9Sml0xEE0jNGLTcFX8tDPz6rlmgBbu3IvA 3RAdm6vXLnwwkADaGiuGxDrYvEUfXEUE783N+CCh0h93AHtwCNwAd79nHL612cq4MZoI KP0WHl7FE5zTq2JW4HTlTLNhhax75+V9J4kRbToDmtT1s4CA11uY4UjjDCZhebj4QfSX CG2Q==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; arc=pass (i=1 spf=pass spfdomain=gmail.com); spf=pass (google.com: domain of linux-kernel+bounces-58617-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45d1:ec00::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-58617-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org X-Forwarded-Encrypted: i=2; AJvYcCXeYyT2w1c889zxgOQPAoLQ2lQX7TPcR5bSrITFb0K0Ao8vEwTWUmi2H4srtBNpYHKzA+Tp6eutXc4h0mJzi7oPEgUCFmV4Cx5bLCMdTg== Return-Path: Received: from ny.mirrors.kernel.org (ny.mirrors.kernel.org. [2604:1380:45d1:ec00::1]) by mx.google.com with ESMTPS id 8-20020a0562140d4800b00683699d4df8si236580qvr.139.2024.02.08.11.26.44 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 08 Feb 2024 11:26:44 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel+bounces-58617-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45d1:ec00::1 as permitted sender) client-ip=2604:1380:45d1:ec00::1; Authentication-Results: mx.google.com; arc=pass (i=1 spf=pass spfdomain=gmail.com); spf=pass (google.com: domain of linux-kernel+bounces-58617-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45d1:ec00::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-58617-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Received: from smtp.subspace.kernel.org (wormhole.subspace.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ny.mirrors.kernel.org (Postfix) with ESMTPS id 5EE231C29B42 for ; Thu, 8 Feb 2024 19:26:08 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 3B402376EB; Thu, 8 Feb 2024 19:25:58 +0000 (UTC) Received: from mail-ot1-f41.google.com (mail-ot1-f41.google.com [209.85.210.41]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 57050374EB; Thu, 8 Feb 2024 19:25:56 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.210.41 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1707420357; cv=none; b=YU4wvRo/JxG5ZaTQJtAWLav+m/9KaZjoKbvqxu2bi91eYp9Th3QYqQuxDEOobECKNvBuFAi4tTpG8wxOLs7nhqlZjCvtqc/M40a/H+GAHUtM2X1z1sK1sRjCU4SyJpLfdPW0XQUTcvMWQMLjOWCV26PIJ8tSIpg3L+ffeQZQTYU= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1707420357; c=relaxed/simple; bh=+YxRwLnaWql45Og/uBWyYcb3+6fMBdrqBtTSrgZdyPg=; h=MIME-Version:References:In-Reply-To:From:Date:Message-ID:Subject: To:Cc:Content-Type; b=XSOIKdcvFo0VBdVLPLnlzfIosKh8nuKgs4QqG5W6uoxzlpsC0zqeC9Azu5FGAID5Bs3pGDc9D3okhz8McQekGZ7dQYdpz+3ebyXAHkwNwYbCcQh2CXrcTGtG+rpnOPSu0FsipCXNLQoa2j5015UhbxqklEW8YmbbbP176BZ59Is= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=fail (p=none dis=none) header.from=kernel.org; spf=pass smtp.mailfrom=gmail.com; arc=none smtp.client-ip=209.85.210.41 Authentication-Results: smtp.subspace.kernel.org; dmarc=fail (p=none dis=none) header.from=kernel.org Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=gmail.com Received: by mail-ot1-f41.google.com with SMTP id 46e09a7af769-6e2be7b83b2so12068a34.1; Thu, 08 Feb 2024 11:25:56 -0800 (PST) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1707420355; x=1708025155; 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=Tb13rhuW8544qF8dDhm649NVENoNwfXmctODywQIT9g=; b=EjvD5wFU+1SSJ94m0sfzv8grdOJCUQz6h+PYY+IIgc8sDbaD3p3VrWBJY4iFDMJ2ZH O16jIX5PJ1SzB+S2QEMgmqKuVbgUT/mop0SUSecJ3mbw50J571WKRPBn7g+GT6FG4CXi u0EnE+ZN2ZdJr9Bv+2u1XtBog33JkAKx4iU7HUGJKaOrzIHSr5E/WYUunmkmulMPQZly T0GG27iYqBkkknBzliBrIPO+Sw8WCipeZBx4l+3k/EKGguwGnp0vyUKKloHLiAhfL+Ah muOwW+7b62njpONr8kBdfvAl7qQqJUZZ5qMpbUOsKW3ydxtoqtuzCrkj7Bj1sP8ceSVi QoEA== X-Forwarded-Encrypted: i=1; AJvYcCUb70/dXogFlTqZR74589E+KsK7FNC7Pf7q0UdiamPZCv9qCTf5NNJtilgeAkiDA6p2FLhVCt3MEPWYU61LG1rsH4vuaona3BVMgEhO5IGA6HgrrWCFOSu1aoiP+F4FQhpO0AkAvrPg9TGXMzuDzOLzxWo0pPgroWEqVpiQBoejtbCH X-Gm-Message-State: AOJu0Yxuh1EM4+LZAi+nqIlQPgtot73NlCXxrEII2P8ryA+A/PvYH3N0 94iJKmKj24Jrb2ceJIWdMM7El2q8yG+VlF7N/xJk1kUxNjOpSh6bcEDbU0pyKchroPpTGPBCmdd 1jbZP0Yj3O0x/C/9Owp5ghJBAoYLDVFC7 X-Received: by 2002:a05:6871:e40b:b0:21a:cf0:2478 with SMTP id py11-20020a056871e40b00b0021a0cf02478mr166961oac.4.1707420355197; Thu, 08 Feb 2024 11:25:55 -0800 (PST) Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 References: <2728491.mvXUDI8C0e@kreacher> <5762433.DvuYhMxLoT@kreacher> In-Reply-To: From: "Rafael J. Wysocki" Date: Thu, 8 Feb 2024 20:25:43 +0100 Message-ID: Subject: Re: [PATCH v1 1/6] thermal: core: Store zone trips table in struct thermal_zone_device To: Stanislaw Gruszka Cc: "Rafael J. Wysocki" , Linux PM , Daniel Lezcano , LKML , Linux ACPI , Lukasz Luba , Zhang Rui , Srinivas Pandruvada , AngeloGioacchino Del Regno Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable On Thu, Feb 8, 2024 at 9:22=E2=80=AFAM Stanislaw Gruszka wrote: > > On Mon, Feb 05, 2024 at 10:14:31PM +0100, Rafael J. Wysocki wrote: > > From: Rafael J. Wysocki > > > > The current code requires thermal zone creators to pass a pointer to a > > writable trips table to thermal_zone_device_register_with_trips() and > > that trips table is then used by the thermal core going forward. > > > > Consequently, the callers of thermal_zone_device_register_with_trips() > > are required to hold on to the trips table passed to it until the given > > thermal zone is unregistered, at which point the trips table can be > > freed, but at the same time they are not allowed to access the cells in > > that table directly. This is both error prone and confusing. > > > > To address it, turn the trips table pointer in struct thermal_zone_devi= ce > > into a flex array (counted by its num_trips field), allocate it during > > thermal zone device allocation and copy the contents of the trips table > > supplied by the zone creator (which can be const now) into it. > > > > This allows the callers of thermal_zone_device_register_with_trips() to > > drop their trip tables right after the zone registration. > > > > Signed-off-by: Rafael J. Wysocki > Reviewed-by: Stanislaw Gruszka Thanks a lot for all of the reviews, much appreciated, especially regarding the Intel drivers changes. Unfortunately, this patch series, and the first half of it in particular, is somewhat premature, because a couple of thermal drivers do unexpected things to their trip point tables and they need to be modified to stop accessing the trip tables directly before the core can start using internal copies of them. I'm going to save the tags for the future, however.