Received: by 2002:a05:6602:2086:0:0:0:0 with SMTP id a6csp4425575ioa; Wed, 27 Apr 2022 03:42:13 -0700 (PDT) X-Google-Smtp-Source: ABdhPJxImu6ZMyvC9S7WxLYpufIIuIy6+ZrUrQTTvfro3U3RC/APCFj6sQEmBkblpiPC6h1j6tHn X-Received: by 2002:a65:4787:0:b0:39d:96b7:bfaa with SMTP id e7-20020a654787000000b0039d96b7bfaamr23835471pgs.495.1651056133135; Wed, 27 Apr 2022 03:42:13 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1651056133; cv=none; d=google.com; s=arc-20160816; b=FbPidUo3LfUe/ZKjJ+PEwYXHQr0Y06CkmIXLOcVfEHLhtTgn1HK/740A5/mDYoJ8p0 U3hL4bi4liLU66S0gc2TZ+9F1Ipz37UK5vxh3+s4dX+CUVZ4PDKEVOwK/4QsBGIrdwuv CIOqYSWu0kJyflKIdFHpbSP/BeAHnDGa5uFJfGc1ps/zKVWD5OFONkYH1Zi4KMoL5NmA ALhWVg9TXV5/MBR/NHPczYGa2lmqfpiKNUdmQUBhRKz0T6zF7DRR3V/+pBVbyvU3wRt4 JBVJSCP36fLFtCSZwktJnpqszMWmu2N3rmSX80sDnH2fDHBL12CtvCCXKRjs/FYZzWpE 8slQ== 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=UkTp7I8GJkE4T4f8M35TVdqOmvEU3i6gW1XeNPqQ8uc=; b=h0Sz+I+WHE4eSChddp7svqzmjdorsGP7QYDE548/fVAjPCIk10qxefCGLLD8znGwD4 +GfMODTMdamBTNMjL6lEzeKiGn7hRrVSHj/Ba10xHyrCO8nCrqoq0hbahtfqTpeAS2KP dR6zaJfMXRxyNnn8squdAk/e9CsSkNPkHogzvSuDwh9DsZ8u2Gzq6HfUWagXaW7rKJcs 3ketln7bPMsMJJ6s9G+/NSwJIm34nHyY5CQ/uIRLvEbtiVjJ4S3vMcy6VbWqSbU00u/D CI+5ODDRHvtaYrSU+UFzod7vyeObpVjZYNKAEbg2VMzScEk6lGi39aGTHQuoaUxPJthI SYaw== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:18 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 lindbergh.monkeyblade.net (lindbergh.monkeyblade.net. [2620:137:e000::1:18]) by mx.google.com with ESMTPS id v7-20020a654607000000b003ab4547739bsi1227916pgq.34.2022.04.27.03.42.12 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 27 Apr 2022 03:42:13 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:18 as permitted sender) client-ip=2620:137:e000::1:18; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:18 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 vger.kernel.org (vger.kernel.org [23.128.96.18]) by lindbergh.monkeyblade.net (Postfix) with ESMTP id CCE083EFC7C; Wed, 27 Apr 2022 02:51:44 -0700 (PDT) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1353735AbiDZTSd (ORCPT + 99 others); Tue, 26 Apr 2022 15:18:33 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:36524 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S243674AbiDZTSb (ORCPT ); Tue, 26 Apr 2022 15:18:31 -0400 Received: from foss.arm.com (foss.arm.com [217.140.110.172]) by lindbergh.monkeyblade.net (Postfix) with ESMTP id 28F935F91 for ; Tue, 26 Apr 2022 12:15:19 -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 1BFE823A; Tue, 26 Apr 2022 12:15:19 -0700 (PDT) Received: from [192.168.178.6] (unknown [172.31.20.19]) by usa-sjc-imap-foss1.foss.arm.com (Postfix) with ESMTPSA id 412C53F774; Tue, 26 Apr 2022 12:15:17 -0700 (PDT) Message-ID: <2244a7f7-9894-06a0-ea51-edf84f6caada@arm.com> Date: Tue, 26 Apr 2022 21:14:58 +0200 MIME-Version: 1.0 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:91.0) Gecko/20100101 Thunderbird/91.5.0 Subject: Re: [PATCH V2] arm64: add SCHED_CLUSTER's dependency on ACPI Content-Language: en-US To: Sudeep Holla , =?UTF-8?B?546L5pOO?= Cc: Catalin Marinas , Will Deacon , "linux-arm-kernel@lists.infradead.org" , "linux-kernel@vger.kernel.org" , "vincent.guittot@linaro.org" , "peterz@infradead.org" References: <1650855303-91388-1-git-send-email-wangqing@vivo.com> <20220425100635.ig4dxvlflglfagpx@bogus> <20220425165946.qb6xilgmjahdh4pa@bogus> <20220426064053.h4rwvcdvmwxj2hmt@bogus> <20220426132511.7zo4w42kauvrq26n@bogus> From: Dietmar Eggemann In-Reply-To: <20220426132511.7zo4w42kauvrq26n@bogus> Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-Spam-Status: No, score=-3.7 required=5.0 tests=BAYES_00, HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI,NICE_REPLY_A, RDNS_NONE,SPF_HELO_NONE autolearn=unavailable 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 On 26/04/2022 15:25, Sudeep Holla wrote: > On Tue, Apr 26, 2022 at 06:52:34AM +0000, 王擎 wrote: >> >>>>>>>> From: Wang Qing >>>>>>>> >>>>>>>> cluster sched_domain configured by cpu_topology[].cluster_sibling, >>>>>>>> which is set by cluster_id, cluster_id can only get from ACPI. >>>>>>>> >>>>>>>> If the system does not enable ACPI, cluster_id is always -1, even enable >>>>>>>> SCHED_CLUSTER is invalid, this is misleading. >>>>>>>> >>>>>>>> So we add SCHED_CLUSTER's dependency on ACPI here. >>>>>>>> >>>>>>> >>>>>>> Any reason why this can't be extended to support DT based systems via >>>>>>> cpu-map in the device tree. IMO we almost have everything w.r.t topology >>>>>>> in DT and no reason to deviate this feature between ACPI and DT. >>>>>>> >>>>>> That's the problem, we parse out "cluster" info according to the >>>>>> description in cpu-map, but do assign it to package_id, which used to >>>>>> configure the MC sched domain, not cluster sched domain. >>>>>> >>>>> >>>>> Right, we haven't updated the code after updating the bindings to match >>>>> ACPI sockets which are the physical package boundaries. Clusters are not >>>>> the physical boundaries and the current topology code is not 100% aligned >>>>> with the bindings after Commit 849b384f92bc ("Documentation: DT: arm: add >>>>> support for sockets defining package boundaries") >>>> >>>> I see, but this commit is a long time ago, why hasn't it been used widely. >>>> Maybe I can help about it if you need. >>>> >>> >>> I assume no one cared or had a requirement for the same. >> >> It took me a while to find the root cause why enabling SCHED_CLUSTER >> didn't work. >> >> We should add SCHED_CLUSTER's dependency before implementation. >> Otherwise, everyone who doesn't have ACPI but use SCHED_CLUSTER >> will have this problem. >> > > I am fine with that or mark it broken for DT, but ideally I wouldn't > want to create unnecessary dependency on ACPI or DT when both supports > the feature. IMHO trying to introduce SCHED_COMPLEX for DT next to the linux-wide available SCHED_CLUSTER (used only for ACPI right now) is the wrong way. _If_ asymmetric sub-clustering of CPUs underneath LLC (L3) makes any sense on ARMv9 single DSU systems like: .---------------. CPU |0 1 2 3 4 5 6 7| +---------------+ uarch |l l l l m m m b| (so called tri-gear: little, medium, big) +---------------+ L2 | | | | | | | +---------------+ L3 |<-- -->| +---------------+ |<-- cluster -->| +---------------+ |<-- DSU -->| '---------------' (and I'm not saying here it does!) then the existing SCHED_CLUSTER should be used in DT as well. Since it provides exactly the same functionality for the task scheduler no matter whether it's setup from ACPI or DT. parse_cluster() -> parse_core() should be changed to be able to decode both id's (package_id and cluster_id) in this case. DT's cpu_map would have to be changed to code 2 level setups. For a system like the one above it should look like: cpu-map { cluster0 { foo0 { core0 { cpu = <&cpu0>; }; core1 { cpu = <&cpu1>; }; }; foo2 { core2 { cpu = <&cpu2>; }; core3 { cpu = <&cpu3>; }; }; }; cluster1 { core0 { cpu = <&cpu4>; }; core1 { cpu = <&cpu5>; }; core2 { cpu = <&cpu6>; }; }; cluster2 { core0 { cpu = <&cpu7>; }; }; }; I pimped my Hikey 960 to look like one of those Armv9 4-3-1 systems with L2-complexes on the LITTLES and I get: # cat /sys/kernel/debug/sched/domains/cpu*/domain*/name CLS MC DIE CLS MC DIE CLS MC DIE CLS MC DIE MC DIE MC DIE MC DIE DIE cat /proc/schedstat | awk '{print $1 " " $2 }' | grep ^[cd] cpu0 0 domain0 03 domain1 0f domain2 ff cpu1 0 domain0 03 domain1 0f domain2 ff cpu2 0 domain0 0c domain1 0f domain2 ff cpu3 0 domain0 0c domain1 0f domain2 ff cpu4 0 domain0 70 domain1 ff cpu5 0 domain0 70 domain1 ff cpu6 0 domain0 70 domain1 ff cpu7 0 domain0 ff Like I mentioned earlier, I'm not sure if this additional complexity makes sense on mobile systems running EAS (since only CFS load-balancing on little CPUs would be affected). But my hunch is that this setup is what you want for your system. If we could agree on this one, that would already be some progress to see the entire story here.