Received: by 2002:a05:7412:d8a:b0:e2:908c:2ebd with SMTP id b10csp848996rdg; Fri, 13 Oct 2023 03:07:36 -0700 (PDT) X-Google-Smtp-Source: AGHT+IFw3kOEnWlocF7tV/tgC9EVYyUHBpWOcOl2FQHAzxl//LBY2ySNVYE8j+8LCorr96MO4oRI X-Received: by 2002:a05:6808:1812:b0:3ae:1255:bf02 with SMTP id bh18-20020a056808181200b003ae1255bf02mr32495897oib.54.1697191655700; Fri, 13 Oct 2023 03:07:35 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1697191655; cv=none; d=google.com; s=arc-20160816; b=qOr6BPDZ3gxt+eM/RDXF/ELViMht/b4HddB7mRG7fUqZLPvv7VsAD+Rfduwdz6Hw3e FkasPLCeQLnT7I81FrnJGkPhZUlFU/Ui2VnLsm8kjvtSZUuGO7HwJPcHtPniDVTafwsP tEl71wfGWWhCrPmc5H0kMeErwku+gLObO2xathqIHYzEYKlaEICaxKMP7W8IKCs9zfRr aKQ5ij2ALSxhi4UQCtj0FXYn3WXoAk6aXxCcCjglt9Z3LIX1NABiM3NAqwpmYmYXEZCa fPKN08jqC1YIMmc9EucxhrJZ+1WL+gf8n3GToMncFpIUmFmFIRpiHu/ARJwIk1Ry1KrB tn1Q== 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=hr42f9GLip0Ou8oUnZjTSRzfzym9GDljOyBxnJ2sQ+A=; fh=0cpBOKuWf+FfnPJZG/zhkSBJdPvgX7kxtRw/of8L22s=; b=FE286UkBz8OedIcF1wNHx8sKXcRRrEl/VzAEMYLQYMRPUIOOLsrQYrx+VvhlvZxg6A 5geBsg3zJWNdH2Fr8yEWYhNQNUN6NtbN/uVL1h+RYW1YmEm18u8fZ2qte58k59JYwLDr pGvIsIslNcZkAyXNJc8TI0Lx0leXVbZj2jEz9ULKUuZ47cxyfwylL55pqBz+fdm+GVHH NCddDjD2M8yYf1V4HxGt7qvRulmbu8BOp4Eu0AX4NvsK4zXN2syPn3Kw7g9051nVg3zl jsKOFyOND5m+2XjCg929fEBC7EgAPBA8vvD5BAmtj4nkXm4JQzq6R61RKgVs/9ZcSWP9 ycwg== 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:6 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 pete.vger.email (pete.vger.email. [2620:137:e000::3:6]) by mx.google.com with ESMTPS id g18-20020a056a0023d200b0069102c864c5si16967149pfc.218.2023.10.13.03.07.35 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 13 Oct 2023 03:07:35 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:6 as permitted sender) client-ip=2620:137:e000::3:6; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:6 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 pete.vger.email (Postfix) with ESMTP id 0035881F3913; Fri, 13 Oct 2023 03:07:32 -0700 (PDT) X-Virus-Status: Clean X-Virus-Scanned: clamav-milter 0.103.10 at pete.vger.email Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231163AbjJMKHZ convert rfc822-to-8bit (ORCPT + 99 others); Fri, 13 Oct 2023 06:07:25 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:59018 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230444AbjJMKHY (ORCPT ); Fri, 13 Oct 2023 06:07:24 -0400 Received: from mail-oo1-f45.google.com (mail-oo1-f45.google.com [209.85.161.45]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 70B65A9; Fri, 13 Oct 2023 03:07:22 -0700 (PDT) Received: by mail-oo1-f45.google.com with SMTP id 006d021491bc7-57b83ff7654so174576eaf.1; Fri, 13 Oct 2023 03:07:22 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1697191642; x=1697796442; 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=aOcuhgIHNpTnqY6TaX7q3jq2KFxLbfHcdT+gFs7TbNI=; b=c2QJAUJ7IxbheoIZ7pu+1VfFgaazPbyALb208I3PUEBG/hyUBByH5L7ne0VpDOHoJ/ DVSoGHC0SDjJ1YjS2oRM6b4/VrKh288RpYVofKGmVWTqxDZsuMhKshen0TuT0JrqJe7y WbpIReDDKSkv+rWlmswiB0Cauq+XP/i1gvKiY/FawBxXL6s+3WqU9xPX5NhHVHGHqVBq zJyx/bMHGdot+8lg0j8VECF1kI6UckznT14xM367Q69JQrgikQVvwQjvipkeYiL3LIaP MyboyN2bP2RKHqV//LsnZFLs9UTO93qcUcrSc1knd8JtezPjwCY5E+VGZAFnpV9Cwgjb aYxw== X-Gm-Message-State: AOJu0YwGjKwWl3U56hKost3j0TNK+wJy+T/3wSpj8NVQOk7Ks0yH+tWu 7NZIR459ibad2AAxs9+8vIbYTcZINycYfq7jJBE= X-Received: by 2002:a4a:b588:0:b0:578:c2af:45b5 with SMTP id t8-20020a4ab588000000b00578c2af45b5mr24853795ooo.0.1697191641719; Fri, 13 Oct 2023 03:07:21 -0700 (PDT) MIME-Version: 1.0 References: <13365827.uLZWGnKmhe@kreacher> <0f6d3d0a-3685-4a0c-b922-b5aa72f20b19@arm.com> In-Reply-To: <0f6d3d0a-3685-4a0c-b922-b5aa72f20b19@arm.com> From: "Rafael J. Wysocki" Date: Fri, 13 Oct 2023 12:07:09 +0200 Message-ID: Subject: Re: [PATCH v1 0/6] thermal: core: Pass trip pointers to governor .throttle() callbacks To: Lukasz Luba Cc: "Rafael J. Wysocki" , LKML , Linux PM , Daniel Lezcano , Srinivas Pandruvada , Zhang Rui 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 pete.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 (pete.vger.email [0.0.0.0]); Fri, 13 Oct 2023 03:07:33 -0700 (PDT) Hi Lukasz, On Fri, Oct 13, 2023 at 10:12 AM Lukasz Luba wrote: > > Hi Rafael, > > > On 10/6/23 18:38, Rafael J. Wysocki wrote: > > Hi All, > > > > While working on https://lore.kernel.org/linux-pm/4846448.GXAFRqVoOG@kreacher/ > > I started to change thermal governors so as to reduce the usage of trip > > indices in them. At that time, I was concerned that they could not be > > replaced with trip pointers overall, because they were needed in certain > > situations (tracing, debug messages, userspace governor) and computing them > > whenever they were needed would be extra overhead with relatively weak > > justification. In the meantime, however, I realized that for a given trip > > pointer, it is actually trivial to compute the corresponding index: it is > > sufficient to subtract the start of the trips[] table in the thermal zone > > containing the trip from that trip pointer for this purpose. Patch [1/6] > > modifies thermal_zone_trip_id() in accordance with this observation. > > > > Now that the cost of computing a trip index for a given trip pointer and > > thermal zone is not a concern any more, the governors can be generally > > switched over to using trip pointers for representing trips. One of the > > things they need to do sometimes, though, is to iterate over trips in a > > given thermal zone (the core needs to do that too, of course) and > > for_each_thermal_trip() is somewhat inconvenient for this purpose, because > > it requires callback functions to be defined and in some cases new data > > types need to be introduced just in order to use it. For this reason, > > patch [2/6] adds a macro for iterating over trip points in a given thermal > > zone with the help of a trip pointer and changes for_each_thermal_trip() to > > use that macro internally. > > > > Patches [3-5/6] change individual governors to prepare them for using trip > > pointers everywhere for representing trips, except for the trip argument of > > the .throttle() callback and patch [6/6] finally changes the .throttle() > > callback definition so that it takes a trip pointer as the argument > > representing the trip. > > > > Please refer to the individual patch changelogs for details. > > > > Thanks! > > > > > > > > I have issues to apply this series, could you tell me the best > base branch from your tree? > > I will give it a try on my boards and review. It is there in the thermal-core branch of linux-pm.git. Thanks!