Received: by 2002:a05:6358:53a8:b0:117:f937:c515 with SMTP id z40csp468754rwe; Fri, 14 Apr 2023 05:47:33 -0700 (PDT) X-Google-Smtp-Source: AKy350bZRkCsRuc4PH306tLknAAsGF1Uo8KF0UHSb82th8wKD26O0fKGEGertxthFSleec1TroBZ X-Received: by 2002:a17:903:2111:b0:1a6:4606:6e06 with SMTP id o17-20020a170903211100b001a646066e06mr1855037ple.17.1681476452809; Fri, 14 Apr 2023 05:47:32 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1681476452; cv=none; d=google.com; s=arc-20160816; b=pv9FX6YbhnnTY75FAytxhdasWeK738WuonJEBtUa6D7IQo6gp0ISdagXbcrQ9qAIvC kceaJE/Un08dCq3c188fqB2LRlBdDi9ZXJXEHukQUUZvfOfxqbDJQdAWrMhvZFzok+/7 4Xj6esOWjcOsWLcZqPgjFydMqtLfrFfnjcZbMxvOm+9quYjL/NZIXiECA2fT7gCo6Lsr /I9Uvl4DcN05O8aqWiFXB5V0RZaaZ06HeW5zUFzFp4z21fr98SOpuao3e8ahQGrpaTRq 4u5x1mAd//bHCBGxNrRePHPM+X3wk6FgHgV7bLDWlWf8RBVYwibgslZacawHK7gM32jh bT6w== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:user-agent:in-reply-to:content-disposition :mime-version:references:message-id:subject:cc:to:from:date :dkim-signature; bh=53nrursvbq4VZ46poanqRqzKxv+EbiR2jIHIAVnFYKo=; b=DtjoQpBa5/ay587RWM76mPlP1G3mtO9DJrktHvOuN7wCNPhOWbFuqzfWzTa7iA3wkC ltkn2Sf55uwjipO9bHENPisIBL+PftmL65skuUr4DjZrK7CnZO4EtfVfz4lO9lO6ycN2 D8BE4ITUKnE5K/xbYobI1rtM+0h+LCAUuYzfoiFHPAbIFxQBm2lkP/ls/HWIdl8+7oqj zAiGgN0gQff/fZgzebnul01gRYG23+eMSipfxcJ6+s35sVAnGm8aSJLI7Poq9w+T+ksY sPkw93YCjfk4XELaE4oOurwrsjlTTHLV7Jb/OqFJ6knUacWBZc8vKDntXpvM5JDlWAhU 9RGg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=XSf3fPp0; 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=kernel.org Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id 188-20020a6304c5000000b005136ea8b484si4712336pge.161.2023.04.14.05.47.19; Fri, 14 Apr 2023 05:47:32 -0700 (PDT) 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=@kernel.org header.s=k20201202 header.b=XSf3fPp0; 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=kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230073AbjDNMqn (ORCPT + 99 others); Fri, 14 Apr 2023 08:46:43 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:33400 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229596AbjDNMql (ORCPT ); Fri, 14 Apr 2023 08:46:41 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [IPv6:2604:1380:4641:c500::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id CC9D311C for ; Fri, 14 Apr 2023 05:46:40 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by dfw.source.kernel.org (Postfix) with ESMTPS id 696226479C for ; Fri, 14 Apr 2023 12:46:40 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id A59DBC433D2; Fri, 14 Apr 2023 12:46:38 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1681476399; bh=CMcPhT/rQ0m4SLI1eptbK4c10a7J4O3y1MSMML07rMY=; h=Date:From:To:Cc:Subject:References:In-Reply-To:From; b=XSf3fPp0Zk2zx4zTo7fiZL4mTNG0sC+EFYqr0MYd6PyYedNAQu1RFPn8gRDpQ3dex uuFexazvcT7ynPh5i1UCWexoaG+qAPNuwsDIbB4V3/RQWaP7N1kbtHcx90UaCcZqtK e8c3xz8WJxe7VuGVNZuyOT9/Gk2k+qKf1rb4Dz9zCDuPS57hvzNt5WwRJHFj45iiVS 6WjJam0kpRi6weAo9i/LJUl6zw52xpjxOB3a8CIlVYnP1TH4Z+TZDhVrxwS8TcDc6/ v3t0ufqr1F6kIJaUUtIk/303Mvvv8u1ubEoPGOsyD+dmX4S4ZhQcYJYKLBK0+MWF6z wW7tIAKxiWnHw== Date: Fri, 14 Apr 2023 13:46:35 +0100 From: Will Deacon To: Sudeep Holla Cc: Radu Rendec , linux-kernel@vger.kernel.org, Catalin Marinas , Pierre Gondois , linux-arm-kernel@lists.infradead.org Subject: Re: [PATCH v4 2/3] cacheinfo: Add arm64 early level initializer implementation Message-ID: <20230414124633.GB27611@willie-the-truck> References: <20230412185759.755408-1-rrendec@redhat.com> <20230412185759.755408-3-rrendec@redhat.com> <20230413102226.yzzd6iccqeamheas@bogus> <20230413144519.GA26421@willie-the-truck> <20230413150505.75g2dp6ra2ytfvpu@bogus> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20230413150505.75g2dp6ra2ytfvpu@bogus> User-Agent: Mutt/1.10.1 (2018-07-13) X-Spam-Status: No, score=-4.4 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_MED, SPF_HELO_NONE,SPF_PASS,T_SCC_BODY_TEXT_LINE 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 On Thu, Apr 13, 2023 at 04:05:05PM +0100, Sudeep Holla wrote: > On Thu, Apr 13, 2023 at 03:45:22PM +0100, Will Deacon wrote: > > On Thu, Apr 13, 2023 at 11:22:26AM +0100, Sudeep Holla wrote: > > > Hi Will, > > > > > > On Wed, Apr 12, 2023 at 02:57:58PM -0400, Radu Rendec wrote: > > > > This patch adds an architecture specific early cache level detection > > > > handler for arm64. This is basically the CLIDR_EL1 based detection that > > > > was previously done (only) in init_cache_level(). > > > > > > > > This is part of a patch series that attempts to further the work in > > > > commit 5944ce092b97 ("arch_topology: Build cacheinfo from primary CPU"). > > > > Previously, in the absence of any DT/ACPI cache info, architecture > > > > specific cache detection and info allocation for secondary CPUs would > > > > happen in non-preemptible context during early CPU initialization and > > > > trigger a "BUG: sleeping function called from invalid context" splat on > > > > an RT kernel. > > > > > > > > This patch does not solve the problem completely for RT kernels. It > > > > relies on the assumption that on most systems, the CPUs are symmetrical > > > > and therefore have the same number of cache leaves. The cacheinfo memory > > > > is allocated early (on the primary CPU), relying on the new handler. If > > > > later (when CLIDR_EL1 based detection runs again on the secondary CPU) > > > > the initial assumption proves to be wrong and the CPU has in fact more > > > > leaves, the cacheinfo memory is reallocated, and that still triggers a > > > > splat on an RT kernel. > > > > > > > > In other words, asymmetrical CPU systems *must* still provide cacheinfo > > > > data in DT/ACPI to avoid the splat on RT kernels (unless secondary CPUs > > > > happen to have less leaves than the primary CPU). But symmetrical CPU > > > > systems (the majority) can now get away without the additional DT/ACPI > > > > data and rely on CLIDR_EL1 based detection. > > > > > > > > > > If you are okay with the change, can I have your Acked-by, so that I can > > > route this via Greg's tree ? > > > > I really dislike the profileration of __weak functions in this file, > > You mean in the generic cacheinfo.c right ? Coz arm64 version must not have > any and that is the file in this patch. Right, but we're providing implementations of both early_cache_level() and init_cache_level(), which are weak symbols in the core code. Will