Received: by 2002:ad5:4acb:0:0:0:0:0 with SMTP id n11csp5452476imw; Wed, 20 Jul 2022 06:09:07 -0700 (PDT) X-Google-Smtp-Source: AGRyM1vdHh/FrtjlLNb9gASDJBBsmV8ZrZTVMgo5Ok/VNNOTWsNG04ghfyDPunWwxuvXiSmbEpuQ X-Received: by 2002:a17:907:7617:b0:72b:49fe:fdf7 with SMTP id jx23-20020a170907761700b0072b49fefdf7mr37214296ejc.25.1658322546861; Wed, 20 Jul 2022 06:09:06 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1658322546; cv=none; d=google.com; s=arc-20160816; b=j2rlWbUUKKzM9SuulzbtfGm5nQ2DNvumSEKgIwKiEiI/jj3G5+bzmGJ7ff+Tf9POCG w7NLaPQFjMDsHcuqV3kZL7KR//RcyM6VE42sWkdS9qmjewirsJVR1AOACHebNqWHSvmE vDobd/9gYfkLIFLNXbRujumfBXU4JWXg7Ix269DErHZdnbG6SzWdwugIwpZFaGAWw7vU vnEHerHnSJfivAqktskLmCcgaw6fIJGj+RnjH8TKAtjLNZm/ceSkvlXcoHhtLxqEfeDU +XjUxwOS5b+2igrzLVV1GVYtRz/u2mC+u4DPNxK7saUo7Sqzrn30QHS7GJr0vhGH9PHY KWWw== 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 :references:in-reply-to:message-id:date:subject:cc:to:from; bh=MGtzbLVgqe39ogTh5AKcDLBi5x1+Yv0uoBsP0egx39U=; b=0qGfeIdsjT6CE7QWs/T04SW0190GQNbskeDXLgQaNV6V4wGIj5zsgy/E6KNw002eL9 dMJLWDPYa5fgT3TZqPFld76xjyiQdXzZ2bNSDy023JVeb+PskUHwOdAe1yklwu01P62h nb/xEC6p9SukHFtDHh1xEYrm2vHKeO8kWzJSNfJLVubhtu/+k8+956B+tetI3AkMIM22 n7JA5b50zDTJCvI2qNhF4OeilH3i36fPySmqRZI560wMGwgt7vp5CpapYYUcZANYONuP BLCO43wmeJUobM2AZ22TJ84zTrm07Hr0kBPXU8yCgGAD9xjrIi7Flgn2uGwgjQIswydG Btcg== 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 bv15-20020a170906b1cf00b0072b40bc7412si19131080ejb.223.2022.07.20.06.08.41; Wed, 20 Jul 2022 06:09:06 -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 S238301AbiGTM4H (ORCPT + 99 others); Wed, 20 Jul 2022 08:56:07 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:57566 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S234243AbiGTM4D (ORCPT ); Wed, 20 Jul 2022 08:56:03 -0400 Received: from foss.arm.com (foss.arm.com [217.140.110.172]) by lindbergh.monkeyblade.net (Postfix) with ESMTP id B281B252; Wed, 20 Jul 2022 05:56:02 -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 02BD915A1; Wed, 20 Jul 2022 05:56:03 -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 C81EA3F70D; Wed, 20 Jul 2022 05:56:00 -0700 (PDT) From: Sudeep Holla To: Sudeep Holla , "Rafael J. Wysocki" , Greg Kroah-Hartman Cc: Dietmar Eggemann , Pierre Gondois , linux-arm-kernel@lists.infradead.org, linux-riscv@lists.infradead.org, Guenter Roeck , linux-acpi@vger.kernel.org, Conor Dooley , linux-kernel@vger.kernel.org, Geert Uytterhoeven , Ionela Voinescu Subject: [PATCH v3 1/3] cacheinfo: Use atomic allocation for percpu cache attributes Date: Wed, 20 Jul 2022 13:55:38 +0100 Message-Id: <20220720-arch_topo_fixes-v3-1-43d696288e84@arm.com> X-Mailer: git-send-email 2.37.1 In-Reply-To: <20220720-arch_topo_fixes-v3-0-43d696288e84@arm.com> References: <20220720-arch_topo_fixes-v3-0-43d696288e84@arm.com> MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" 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 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; -- b4 0.10.0-dev-54fef