Received: by 2002:ad5:4acb:0:0:0:0:0 with SMTP id n11csp307251imw; Fri, 15 Jul 2022 03:46:22 -0700 (PDT) X-Google-Smtp-Source: AGRyM1uhnLzoHd7EJZYXJvbre/asbePQZSnWq9TD8VJzBkwvpzfeTda7up61RXdhmQtZT8lklGeh X-Received: by 2002:a17:903:41c7:b0:16c:4e4c:7440 with SMTP id u7-20020a17090341c700b0016c4e4c7440mr13270259ple.169.1657881981966; Fri, 15 Jul 2022 03:46:21 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1657881981; cv=none; d=google.com; s=arc-20160816; b=wlZZCXQYkd1niV5G2Vk/8zpAnO2ZtqV6siJFyy1j8zGoufpGys6hlGRYL8isKVBqoi eAcwz91xp4DKnpskHDiGKEtZJtyDX1kyqT6XaOmjo/HkM6brA1WKOOqz3Qucyn/aOIxd C2CMDoLe16kYMfq13EKffFZ+w87sA4kMvndJQXjAOJjiGBquHBoP7ZK6cv6fN/cN+lCR vblD+PRqjHcM4MPulNkQVm6s6GaFpedF5qw+PJbJZuldAOzWVROHY3EicUhKdgZjixvA gqwbhR5Ar8USU3eW+oKzmxFJKOi6YgJvT+PJKJv+ENwLCuTxMeJ9Va4Zc7/YHtFp9raE UAXA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :message-id:date:subject:cc:to:from; bh=4qSdAAZhnQvM8XwI5lNL+LjX38vMlAcMG/QjBoPBhRU=; b=iFnXvE2KdXVwtFLvwFY9iz0Pk+YCNJau3t80Oiv/z5eWc/lCuKxQzDSzyui/iP8zmw COsp59eu6KhIs0mKRWF94XVN9wCrcteX865+83I2BV37fjXXC1H2VaOCA3u7rXca4mSV B1ikfesNlkE+oPm+dn8B9YFBCyacR8WJngrmoaxxM/gxC60knkhV3FVFaLB3tGsIB48o ol+t7Fpa2whAVROKrX+Lwab8wEF5hQhJVYI/fHdFCzXeax0G7eD2y4qpRWJhCb12/Tdl 6kRSlnwgoN3WcCdyuFCJlucBMIvXir1SmeXAIWyrAo/28u066tQQ7QtsEPO40B2f8qW9 BJxg== 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:20 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 out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id l14-20020a63f30e000000b00415c14120ecsi5214034pgh.796.2022.07.15.03.46.05; Fri, 15 Jul 2022 03:46:21 -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; 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=fail (p=NONE sp=NONE dis=NONE) header.from=arm.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S232916AbiGOK0W (ORCPT + 99 others); Fri, 15 Jul 2022 06:26:22 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:60378 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231508AbiGOK0T (ORCPT ); Fri, 15 Jul 2022 06:26:19 -0400 Received: from foss.arm.com (foss.arm.com [217.140.110.172]) by lindbergh.monkeyblade.net (Postfix) with ESMTP id 74379796A6 for ; Fri, 15 Jul 2022 03:26:18 -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 942BD1474; Fri, 15 Jul 2022 03:26:18 -0700 (PDT) Received: from usa.arm.com (e103737-lin.cambridge.arm.com [10.1.197.49]) by usa-sjc-imap-foss1.foss.arm.com (Postfix) with ESMTPA id C99223F792; Fri, 15 Jul 2022 03:26:16 -0700 (PDT) From: Sudeep Holla To: linux-kernel@vger.kernel.org, Greg Kroah-Hartman , Conor Dooley Cc: Sudeep Holla , Vincent Guittot , Dietmar Eggemann , Ionela Voinescu , Pierre Gondois , linux-arm-kernel@lists.infradead.org, linux-riscv@lists.infradead.org Subject: [PATCH -next v2 1/2] cacheinfo: Use atomic allocation for percpu cache attributes Date: Fri, 15 Jul 2022 11:26:08 +0100 Message-Id: <20220715102609.2160689-1-sudeep.holla@arm.com> X-Mailer: git-send-email 2.37.1 MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Spam-Status: No, score=-6.9 required=5.0 tests=BAYES_00,RCVD_IN_DNSWL_HI, SPF_HELO_NONE,SPF_NONE 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 couple of architectures like RISC-V and ARM64, we need to detect cache attribues quite early during the boot when the secondary CPUs start. So we will call detect_cache_attributes in the atomic context and since use of normal allocation can sleep, we will end up getting "sleeping in the atomic context" bug splat. In order avoid that, move the allocation to use atomic version in preparation to move the actual detection of cache attributes in the CPU hotplug path which is atomic. Cc: Ionela Voinescu Tested-by: Conor Dooley Signed-off-by: Sudeep Holla --- drivers/base/cacheinfo.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) Hi Greg, Can you apply these couple of patches directly if and when you are happy with them ? Regards, Sudeep v1->v2: This was added in v2 diff --git a/drivers/base/cacheinfo.c b/drivers/base/cacheinfo.c index 65d566ff24c4..4b5cd08c5a65 100644 --- a/drivers/base/cacheinfo.c +++ b/drivers/base/cacheinfo.c @@ -356,7 +356,7 @@ int detect_cache_attributes(unsigned int cpu) return -ENOENT; per_cpu_cacheinfo(cpu) = kcalloc(cache_leaves(cpu), - sizeof(struct cacheinfo), GFP_KERNEL); + sizeof(struct cacheinfo), GFP_ATOMIC); if (per_cpu_cacheinfo(cpu) == NULL) { cache_leaves(cpu) = 0; return -ENOMEM; -- 2.37.1