Received: by 2002:a05:6358:d09b:b0:dc:cd0c:909e with SMTP id jc27csp2177500rwb; Wed, 30 Nov 2022 03:30:02 -0800 (PST) X-Google-Smtp-Source: AA0mqf4J2q/RukrbO0mYyGCgCUcUJSSFdo3DlIByzSSwgwtsKXeKaLkj0x9NeX/Opfa3bOrihAMT X-Received: by 2002:a62:405:0:b0:573:9738:292f with SMTP id 5-20020a620405000000b005739738292fmr42271090pfe.9.1669807801827; Wed, 30 Nov 2022 03:30:01 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1669807801; cv=none; d=google.com; s=arc-20160816; b=qU2NPm+3ARL1lT6ygju/FB66WbjNLApHulqetw53YU1nQRaG7LFVbNmjnIqfUkiB+W wxgnuiGgnGZNqi8hFKHaPp640OyeflEmoUpcfw9aFf22+j5j3gVLd4JkocjZdtBcZb2H Se+jRVCJoJ1DqwLVz9BYoMOUHOCzC/TVmT4YouRx10JetJv0gbv0uQUQLc8EMh5rwC4V HKvuNbfWyY/ST2QFXha5L3+mGuxD4hGa46FJGDTkBaNBGOswh7Cf4uavhFZ+MrUh+R2Y IpRwM/BKAOeTFHJHtESpleTqlElrQw3EssB/CgCb0MEKs0Bq8+p7H7N4ML7zV5Gcov1/ djRA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:cc:to:subject:message-id:date:from:in-reply-to :references:mime-version:dkim-signature; bh=SJLkT7UJgdz9DbjtRID1Ehj3joyySjkZxkwxrfsCaVE=; b=w5N2LOmlkKBnB55OUxre1MziF73VTTCM/C/SPA9tz6HKzUIrH/ZTFRc9oUViqgIPTa KkYxRdf3DPSdTH2QqOe0l4yX96M0TQ5sSf5kcLby+t8eU7N+eWhorChWS6JwHjf3NSkk yz33MeF3R3HK0DqOTLcRx4fNc2g/MdNFa9ryyu7Jq9x9YoX+TrX7WtjExIWIdUAZYjcd BDPzQTsxKKmJsoODWstVSpJgRIdBHQ1cuWQxkAEOngsckoQ7LKFmvgTEe69GG8vUS6KU lm+VPPF4VW+hd+J36p0jBSV7srRad0p00j6uVNo1WqFHaCdCbegYPIUBuwB99U5GlAQ4 L6Jw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=hxQWQWHB; 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=linaro.org Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id om13-20020a17090b3a8d00b0021824fcc6b9si1404638pjb.63.2022.11.30.03.29.51; Wed, 30 Nov 2022 03:30:01 -0800 (PST) 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; dkim=pass header.i=@linaro.org header.s=google header.b=hxQWQWHB; 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=linaro.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231805AbiK3Kmi (ORCPT + 84 others); Wed, 30 Nov 2022 05:42:38 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:41948 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231492AbiK3Kmf (ORCPT ); Wed, 30 Nov 2022 05:42:35 -0500 Received: from mail-il1-x12f.google.com (mail-il1-x12f.google.com [IPv6:2607:f8b0:4864:20::12f]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id A1269B9D for ; Wed, 30 Nov 2022 02:42:32 -0800 (PST) Received: by mail-il1-x12f.google.com with SMTP id o13so7925194ilc.7 for ; Wed, 30 Nov 2022 02:42:32 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=cc:to:subject:message-id:date:from:in-reply-to:references :mime-version:from:to:cc:subject:date:message-id:reply-to; bh=SJLkT7UJgdz9DbjtRID1Ehj3joyySjkZxkwxrfsCaVE=; b=hxQWQWHB1MfR6QvYlK0kOcOu8nIcceTFo7sWaaSq0mp2yBsphoiSrRC3li6pHxRXw0 Go2QQj8rffhY/e/hLL6gKwwOnT/dz4oxoH/CpDYt+KZMbHF9fcH63EA8mbbx52L/WoND Z4MS5wEaNEU1LngpSFd4WHzk0ucaD+8qgVYX1HqJolFJoM2uYw/qMw+hvqCWmRg11y9f q5lgGS0b8f8saSvo7gAgVNrFCOfuD7FCsblMDi10ey+IJb/wnjn5Ma+wQNxKA8TpTjSY If1dUuzuxZAO0NxZvzVO4lEc1W1aO2aeYiC2wsJtQQtFb8NRYi3pHAFCS/dltFt+w8w8 Ah5Q== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=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=SJLkT7UJgdz9DbjtRID1Ehj3joyySjkZxkwxrfsCaVE=; b=s4rxEnt0vpUHcJhlQ/crWaQtDcVcm5raVxFp7y9NrrZlvD3jF0qVm5IuTccgQ6vp+z eO7udFKGozbTaFqWrVljL1CwRfcDb/uBciV9xr1iPBB01soyOv8vklMxq+1ujgacbZHC nqG3tx78XWLYSPYC1BCfjEVTYa02mcmDQ8T5rHNLtouGl3NyOgim/XWDgM3twd/JOIXC QbpXn4N6jyaF87qxUq7vHAdWXc4S+8yXRYVwFIfPkpSksTNfNgBXDvry10tQmcp3oR65 iElRrusKkWsY24FAx2j2g6QVHXP6rK0sSnd6HUpw90frlsfLA9Z+OMMXPwxGCQ/gawqU 97Og== X-Gm-Message-State: ANoB5pmlzh4cIhB/MiJWuynx0tcF6rAxQGorDkrX4e9Hm/jcSW1qyBYZ QzBcqnZgBHP9/aBsD2Y+rKhI3aT0INRICwU6B/JiqA== X-Received: by 2002:a92:7c0c:0:b0:302:efa3:6230 with SMTP id x12-20020a927c0c000000b00302efa36230mr13856885ilc.232.1669804951940; Wed, 30 Nov 2022 02:42:31 -0800 (PST) MIME-Version: 1.0 References: <20221110195732.1382314-1-wusamuel@google.com> <880b7332-562c-4934-4e92-493b112568c9@arm.com> <97af1300-541d-a79c-404c-92886f10b220@arm.com> In-Reply-To: <97af1300-541d-a79c-404c-92886f10b220@arm.com> From: Vincent Guittot Date: Wed, 30 Nov 2022 11:42:20 +0100 Message-ID: Subject: Re: [PATCH v1] Revert "cpufreq: schedutil: Move max CPU capacity to sugov_policy" To: Lukasz Luba Cc: "Rafael J. Wysocki" , Sam Wu , Saravana Kannan , Viresh Kumar , Ingo Molnar , Peter Zijlstra , Juri Lelli , Dietmar Eggemann , Steven Rostedt , Ben Segall , Mel Gorman , Daniel Bristot de Oliveira , Valentin Schneider , "Isaac J . Manjarres" , kernel-team@android.com, "Rafael J. Wysocki" , linux-pm@vger.kernel.org, linux-kernel@vger.kernel.org Content-Type: text/plain; charset="UTF-8" X-Spam-Status: No, score=-2.1 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_NONE, SPF_HELO_NONE,SPF_PASS autolearn=ham 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 Hi All Just for the log and because it took me a while to figure out the root cause of the problem: This patch also creates a regression for snapdragon845 based systems and probably on any QC chipsets that use a LUT to update the OPP table at boot. The behavior is the same as described by Sam with a staled value in sugov_policy.max field. Regards, Vincent On Tue, 22 Nov 2022 at 09:58, Lukasz Luba wrote: > > Hi Rafael and Sam > > On 11/21/22 19:18, Rafael J. Wysocki wrote: > > On Fri, Nov 18, 2022 at 2:00 AM Sam Wu wrote: > >> > >> On Wed, Nov 16, 2022 at 3:35 AM Lukasz Luba wrote: > >>> Which mainline kernel version you use in pixel6? > >> I am using kernel version 6.1-rc5. > >>> > >>> Could you elaborate a bit how is it possible? > >>> Do you have the sg_policy setup properly (and at right time)? > >>> Do you have the cpu capacity from arch_scale_cpu_capacity() > >>> set correctly and at the right time during this cpufreq > >>> governor setup? > >>> > >>> IIRC in Android there is a different code for setting up the > >>> cpufreq sched governor clones. In mainline we don't have to do > >>> those tricks, so this might be the main difference. > >> This behavior is seen on the mainline kernel. There isn't any vendor code > >> modifying the behavior, and the schedutil governor is being used. > >>> > >>> Could you trace the value that is read from > >>> arch_scale_cpu_capacity() and share it with us? > >>> I suspect this value changes in time in your kernel. > >> There's an additional CPU capacity normalization step during > >> init_cpu_capacity_callback() that does not happen until all the CPUs come > >> online. However, the sugov_start() function can be called for a subset of > >> CPUs before all the CPUs are brought up and before the normalization of > >> the CPU capacity values, so there could be a stale value stored > >> in sugov_policy.max field. > > > > OK, the revert has been applied as 6.1-rc material, thanks! > > I was on a business trip last week so couldn't check this. > Now I'm back and I've checked the booting sequence. > Yes, there is some race condition and the mechanism > using blocking_notifier_call_chain() in the cpufreq_online() > doesn't help while we are registering that schedutil > new policy. > > I will have to go through those mechanisms and check them. > I agree, for now the best option is to revert the patch. > > My apologies for introducing this issues. > Thanks Sam for capturing it. > > Regards, > Lukasz