Received: by 2002:a05:7412:d8a:b0:e2:908c:2ebd with SMTP id b10csp470466rdg; Thu, 12 Oct 2023 10:44:27 -0700 (PDT) X-Google-Smtp-Source: AGHT+IHMUtBBH4Jx94xKKnZhZj98wssfO9ghItjkOKKxJGcTjUOEP4QWcffD5eHl0DaEIgbRqqdg X-Received: by 2002:a05:6a20:a108:b0:16b:f71d:1b82 with SMTP id q8-20020a056a20a10800b0016bf71d1b82mr18274356pzk.34.1697132666796; Thu, 12 Oct 2023 10:44:26 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1697132666; cv=none; d=google.com; s=arc-20160816; b=0Boe5DztOPdWDXVgkpKA8lzW0xQ1nqOpC3+TifSDU2C5/fH++8XnqMAeb2s2HjbiWr +lnqfLpKFscbKuyf5qdU+fFNex0XUHi9CGknbI82KUCABU1w8Bx7y0x4FBB+h3fbffTS oyYldyERh+RUyhXCri0/tVSHHRoe3QFJ64s/WqMyMM4YdBNTDPFiVK8RwNIXlp70cbnm bKUshJTCne6wYXFZaLKYlRQA4hvcXuG4b2SB86z/hkfT4Vuao24EQOMOMK3yAdUFxcWu JyZ+XDBYlrG/ZVicCEfA0W0erYdRuAhTfY2bBFRmus/kvxZltYxfr7kIrfBmJBR4ptM/ /7Dg== 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=TK5t8X0O/lTg61bISkwvu/GNn3s1UIzgFdX0IcmpynA=; fh=BMHA0cKRggEQiBQ0zWsldzjLdABqRj7aBi9BNa1T6sY=; b=bvE2Fs9VxpAmpoIYqSyXhzlbHbbMK9p2fqTSZKBVAktjMnUCMD4kog4ZAX1cZWTEQM kVNugAb+OCEKVB3cQoNVHUjs/7UJ9hlBgcV+yCgc5XxC8MNigzOLNe/mmXwC5ugA6b+2 QwAqyhjXYA1VNtcIf2s8vXSUxy6vzOOy/VKmCVKidTpXtDgysJQDHjFue7VEXLzgPFJc YEHwwBaJXPFmSoCbbYGFEMdNiM8G3Pc1grs3p+Je2mHVCYZ8zGIppqvKCigiTXnUkJbM FLjJB74qwVjIikt8fArYyWLtxG9QmQk95Fw7Y8OzzVnk+7fqxMr/u4QV/aab2SYZnezl EC2Q== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:2 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 agentk.vger.email (agentk.vger.email. [2620:137:e000::3:2]) by mx.google.com with ESMTPS id f38-20020a635566000000b005a0193c9328si2530861pgm.839.2023.10.12.10.44.26 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 12 Oct 2023 10:44:26 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:2 as permitted sender) client-ip=2620:137:e000::3:2; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:2 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Received: from out1.vger.email (depot.vger.email [IPv6:2620:137:e000::3:0]) by agentk.vger.email (Postfix) with ESMTP id 26CBF819F992; Thu, 12 Oct 2023 10:44:23 -0700 (PDT) X-Virus-Status: Clean X-Virus-Scanned: clamav-milter 0.103.10 at agentk.vger.email Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1379555AbjJLRoP convert rfc822-to-8bit (ORCPT + 99 others); Thu, 12 Oct 2023 13:44:15 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:50686 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1344050AbjJLRoO (ORCPT ); Thu, 12 Oct 2023 13:44:14 -0400 Received: from mail-oo1-f53.google.com (mail-oo1-f53.google.com [209.85.161.53]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 27491C9; Thu, 12 Oct 2023 10:44:13 -0700 (PDT) Received: by mail-oo1-f53.google.com with SMTP id 006d021491bc7-57ddba5ba84so133367eaf.0; Thu, 12 Oct 2023 10:44:13 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1697132652; x=1697737452; 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=Pe7bpLJT3uvTuZB09KxlybQ/Xw31ItduIV6kQwN3xO4=; b=VQswEwKWNUlZSkEKh00OKM3ZYfk5bgn2keF0F4k5tOFEQC/JPOkkh10A7qIKkR2gFP haGNsw/swUypTQ+e8kJEXnPxbVAxD1LCFf6UxjNAldYzg0xcVrFtodTpMtO9ELyw7FvF LtXVuEth5IXymvreOWqnq3E66GgpbLkdfr0f5EKAD5VHAYDfqXsZnhTCTO1p99YGjck8 nSwulXneOLyjP9wcnwF4Ilmu87m9BiY5ZYCVvFO6Vsssxwlf5nFILTLBdFSxsvILQtv2 79SQXBmziYH9EO9r76cavfuC8gP6TLxu/uUov5Lh7IeZ71R/tVm4Fj+Pc1tUUQ1SS28F fR9A== X-Gm-Message-State: AOJu0YyyF/zb1L0Y6FTRYyo/INzdqX7mv0ccoLNeWTxTpoWtD2axZ5ki 52pvFD8C0rTc3XTc2obotEv0G2qyJAOlCDdEdMs= X-Received: by 2002:a05:6820:390:b0:57c:6e35:251e with SMTP id r16-20020a056820039000b0057c6e35251emr23653110ooj.1.1697132652457; Thu, 12 Oct 2023 10:44:12 -0700 (PDT) MIME-Version: 1.0 References: <20231012102700.2858952-1-daniel.lezcano@linaro.org> In-Reply-To: From: "Rafael J. Wysocki" Date: Thu, 12 Oct 2023 19:44:01 +0200 Message-ID: Subject: Re: [PATCH 1/2] thermal/core: Hardening the self-encapsulation To: Daniel Lezcano Cc: Lukasz Luba , Thierry Reding , rafael@kernel.org, Amit Kucheria , Zhang Rui , "open list:THERMAL" , open list Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: 8BIT X-Spam-Status: No, score=-1.0 required=5.0 tests=MAILING_LIST_MULTI, SPF_HELO_NONE,SPF_PASS autolearn=unavailable autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on agentk.vger.email Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-Greylist: Sender passed SPF test, not delayed by milter-greylist-4.6.4 (agentk.vger.email [0.0.0.0]); Thu, 12 Oct 2023 10:44:23 -0700 (PDT) On Thu, Oct 12, 2023 at 3:14 PM Daniel Lezcano wrote: > > > Hi Lukasz, > > On 12/10/2023 14:01, Lukasz Luba wrote: > > Hi Daniel, > > > > On 10/12/23 11:26, Daniel Lezcano wrote: > >> The thermal private header has leaked all around the drivers which > >> interacted with the core internals. The thermal zone structure which > >> was part of the exported header led also to a leakage of the fields > >> into the different drivers, making very difficult to improve the core > >> code without having to change the drivers. > >> > >> Now we mostly fixed how the thermal drivers were interacting with the > >> thermal zones (actually fixed how they should not interact). The > >> thermal zone structure will be moved to the private thermal core > >> header. This header has been removed from the different drivers and > >> must belong to the core code only. In order to prevent this private > >> header to be included again in the drivers, make explicit only the > >> core code can include this header by defining a THERMAL_CORE_SUBSYS > >> macro. The private header will contain a check against this macro. > >> > >> The Tegra SoCtherm driver needs to access thermal_core.h to have the > >> get_thermal_instance() function definition. It is the only one > >> remaining driver which need to access the thermal_core.h header, so > >> the check will emit a warning at compilation time. > >> > >> Thierry Reding is reworking the driver to get rid of this function [1] > >> and thus when the changes will be merged, the compilation warning will > >> be converted to a compilation error, closing definitively the door to > >> the drivers willing to play with the thermal zone device internals. > > > > That looks like a good idea. Although, shouldn't we avoid the > > compilation warnings and just first merge the fixes for drivers? > > Yes, we should but there is the series for nvidia (pointed in the > changelog) which need a slight refresh for the bindings AFAIR. That > series is since March 2023 and Thierry seems busy [1]. I'm holding the > hardening since then. > > So I don't know how to make progress on this? I was assuming we can > merge this series and let the compiler recall what has to be fixed. > > [1] https://lore.kernel.org/all/ZK14edZUih1kH_sZ@orome/ > > and as soon as it is fixed, we convert the WARNING to ERROR :P To be honest, I'm not sure if anything needs to be done along the lines of this patch right now or even at all. The only concern here would be that some new drivers would include thermal_core.h while we were waiting for the remaining existing abusers to be fixed, but since this hasn't happened for the last 6 months, I'm not worried. It would be good to add a notice to thermal_core.h that this file is for internal use in the thermal core only, though.