Received: by 2002:a05:7412:2a8c:b0:e2:908c:2ebd with SMTP id u12csp3774984rdh; Fri, 29 Sep 2023 01:43:09 -0700 (PDT) X-Google-Smtp-Source: AGHT+IGjEqyOT8M/xFi6mkIcdvnA8ZP/1aLydjIrYhjNMoXBiAXBe0k8zIBLa7s/zsQeIWnJD1ob X-Received: by 2002:a92:cdab:0:b0:34c:d0d6:5137 with SMTP id g11-20020a92cdab000000b0034cd0d65137mr4392152ild.8.1695976989126; Fri, 29 Sep 2023 01:43:09 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1695976989; cv=none; d=google.com; s=arc-20160816; b=ifvZHZEPhzkEMrG7JW9k1eegSr+xIM36fImVNAWoCt8qJRn7LC9AvJ4Dyld0FcWKt5 GH5fCEb7aaM3AmqFi+tdeacKnd5eq9cRxgWlZ2L73+hWupQmm7p/aqeH5hiDQgDJnkg1 NmsPTDTjpowx8WS23aJQiSMvz22kVZXLhIoNZAJYpkLwCqJ76qJzZsSy11R9ridqA1lP bxEP9UTjTRFxCAE23KWJT5U+VkLvyYhSTuMyWZLVZ/7mfx7Du5xreQGfsvLnCOIaxtFM QPmkm7HvSDY5/aGUQi6F+vJP0NgNHF7x0FKVe7s2TW1ZodFFNFo4ykxvQonRFd6sHsJ9 votA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:in-reply-to:from :references:cc:to:content-language:subject:user-agent:mime-version :date:message-id; bh=82TGinMnZic3vC80kfnH25F94yihr95iCVYCx8ANiq0=; fh=Sntd+G0CthFoKfHeh5KAtcEJMuc35jsG6LFomUCRudQ=; b=dmf0zqTseMeNbguY8mLGD7+msjJBBqk9JL9jwLUzM80Zra3jwQL49CWAvW2sIoSRm3 lA89r9janTqWIq8mbvqNWdIqbell8WoIZoXBMzU4jW4ZATTDseDvG3GB4n/5/gQ0/hHQ 2H8SP8xl/hvhromsA5/bZZipnH5JA+V79qnt0T4jOwgciVmrgXb10z1BgbmFv+lV41KE tIiTqnHANFUmq3CYP0qMeIBDIEaQ+JfYQjQ3de59nTyXxs7UXYWODO//2QMElBO/iP4w rYAj3vqOTg2CiZnPU4sE9ahoAUzeuFx9sNmh5Mk1ZO6GpcVN0csxuXpSio4xf/cJaWhs A4PA== 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=fail (p=NONE sp=NONE dis=NONE) header.from=arm.com Return-Path: Received: from agentk.vger.email (agentk.vger.email. [2620:137:e000::3:2]) by mx.google.com with ESMTPS id b13-20020a63d80d000000b0056a36f9eb0esi9313067pgh.15.2023.09.29.01.43.08 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 29 Sep 2023 01:43:09 -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=fail (p=NONE sp=NONE dis=NONE) header.from=arm.com Received: from out1.vger.email (depot.vger.email [IPv6:2620:137:e000::3:0]) by agentk.vger.email (Postfix) with ESMTP id 94D9081ED055; Fri, 29 Sep 2023 01:42: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 S232784AbjI2ImM (ORCPT + 99 others); Fri, 29 Sep 2023 04:42:12 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:49914 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232621AbjI2ImK (ORCPT ); Fri, 29 Sep 2023 04:42:10 -0400 Received: from foss.arm.com (foss.arm.com [217.140.110.172]) by lindbergh.monkeyblade.net (Postfix) with ESMTP id 4B4F41AB; Fri, 29 Sep 2023 01:42:08 -0700 (PDT) Received: from usa-sjc-imap-foss1.foss.arm.com (unknown [10.121.207.14]) by usa-sjc-mx-foss1.foss.arm.com (Postfix) with ESMTP id 63FC41FB; Fri, 29 Sep 2023 01:42:46 -0700 (PDT) Received: from [10.57.93.169] (unknown [10.57.93.169]) by usa-sjc-imap-foss1.foss.arm.com (Postfix) with ESMTPSA id C1C313F5A1; Fri, 29 Sep 2023 01:42:05 -0700 (PDT) Message-ID: <6942961b-a5f6-983a-e5c5-10fa097a907d@arm.com> Date: Fri, 29 Sep 2023 09:42:45 +0100 MIME-Version: 1.0 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:102.0) Gecko/20100101 Thunderbird/102.15.1 Subject: Re: [PATCH v4 06/18] PM: EM: Check if the get_cost() callback is present in em_compute_costs() Content-Language: en-US To: "Rafael J. Wysocki" Cc: linux-kernel@vger.kernel.org, linux-pm@vger.kernel.org, dietmar.eggemann@arm.com, rui.zhang@intel.com, amit.kucheria@verdurent.com, amit.kachhap@gmail.com, daniel.lezcano@linaro.org, viresh.kumar@linaro.org, len.brown@intel.com, pavel@ucw.cz, mhiramat@kernel.org, qyousef@layalina.io, wvw@google.com References: <20230925081139.1305766-1-lukasz.luba@arm.com> <20230925081139.1305766-7-lukasz.luba@arm.com> From: Lukasz Luba In-Reply-To: Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 8bit X-Spam-Status: No, score=-4.0 required=5.0 tests=HEADER_FROM_DIFFERENT_DOMAINS, MAILING_LIST_MULTI,NICE_REPLY_A,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]); Fri, 29 Sep 2023 01:42:23 -0700 (PDT) On 9/26/23 19:46, Rafael J. Wysocki wrote: > On Mon, Sep 25, 2023 at 10:11 AM Lukasz Luba wrote: >> >> The em_compute_cost() is going to be re-used in runtime modified EM >> code path. Thus, make sure that this common code is safe and won't >> try to use the NULL pointer. The former em_compute_cost() didn't have to >> care about runtime modification code path. The upcoming changes introduce >> such option, but with different callback. Those two paths which use >> get_cost() (during first EM registration) or update_power() (during >> runtime modification) need to be safely handled in em_compute_costs(). > > I would just say something like this: > > "Subsequent changes will introduce a case in which cb->get_cost may > not be set in em_compute_costs(), so add a check to ensure that it is > not NULL before attempting to dereference it." > > The rest of the changelog is just redundant IMO. > Make sense, thanks, I'll change that.