Received: by 2002:a05:6358:11c7:b0:104:8066:f915 with SMTP id i7csp989813rwl; Fri, 24 Mar 2023 05:00:36 -0700 (PDT) X-Google-Smtp-Source: AKy350ZDPhbG1aBH0VcoJKYNU1RSNxdW/rND336sAU82yksY/XxWFNGjRleeT1LWWzsST5OIgxd7 X-Received: by 2002:a50:ef09:0:b0:4fa:cbd8:3f6f with SMTP id m9-20020a50ef09000000b004facbd83f6fmr2740828eds.6.1679659236100; Fri, 24 Mar 2023 05:00:36 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1679659236; cv=none; d=google.com; s=arc-20160816; b=zg0Al0lYgOs+ZDiY4nBrgvowYJfXkL/F7GourQHgue5SaKNu/zFm/CfLbGlGn+yTEv MeXBUYvdCyCnKvvdoQ6UAsqIR+Uovht3R7/tJHnxRfBBr3v4qg69xoikL+1/g9EjpEQ5 +9+4t/a6i9kB+kdZfT4a49huyh9RlgPofIaJaSPrqUXts5jRJVZswpnMZFeLwuG1wK5u kGd0OAyKgAwQDme1BdGQNr/WVtOY5eGuwpt8dtLc4IQxFhuzHXv4MElmQGYWopQfIeek DGT6tRxwQdmj+v4lZrH9lLuNMkahKJiMOF9O9jGyXN4MSkn6ar1FzSHxxqOGRx/OqiZa hviw== 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:dkim-signature:dkim-signature:from; bh=KDPHyC6kWyePMtKLTpdAD+GT0kcy5lpaGKk40vT9Trk=; b=RwfQ8hLrXZd6UJnUKcZx+ZmfTEq7CiitI+VbGgseZrC0is8H4jKMOeVa5Goh5yr909 KZprDpM1r7cbfGhTwxDII0Mg44/ZHnvE23IKgla5wF2jG4A7BMqDILtNPIOkESd9J4/8 Q+/YDhGXt+sCJz58sSphH2fl7ki9iC8+0MoZnNir9Rai+L+tca7ITWXDlQ60IkqHSjO8 adqgEJzxbMWRZgE3EzBWNEPL22iCVCQ0zsdqGbx2Aj0v41Qv8K+m0SNUZ/uoUPeBbxJO Yfg5tnP/Ymyz3qe50gqO+RGNWge/kEcdBZV8crVmeBue72bGFyiSQSIgAfbBq7h0P7tM XenQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linutronix.de header.s=2020 header.b=pYBaWSXT; dkim=neutral (no key) header.i=@linutronix.de header.s=2020e header.b=p7MsW3zN; 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=QUARANTINE dis=NONE) header.from=linutronix.de Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id s15-20020aa7d78f000000b0050202f2d6a7si4924281edq.319.2023.03.24.05.00.02; Fri, 24 Mar 2023 05:00:36 -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=@linutronix.de header.s=2020 header.b=pYBaWSXT; dkim=neutral (no key) header.i=@linutronix.de header.s=2020e header.b=p7MsW3zN; 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=QUARANTINE dis=NONE) header.from=linutronix.de Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231346AbjCXLrZ (ORCPT + 99 others); Fri, 24 Mar 2023 07:47:25 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:53592 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229600AbjCXLrY (ORCPT ); Fri, 24 Mar 2023 07:47:24 -0400 Received: from galois.linutronix.de (Galois.linutronix.de [IPv6:2a0a:51c0:0:12e:550::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 54D17212B1 for ; Fri, 24 Mar 2023 04:47:23 -0700 (PDT) From: John Ogness DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linutronix.de; s=2020; t=1679658441; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version: content-transfer-encoding:content-transfer-encoding; bh=KDPHyC6kWyePMtKLTpdAD+GT0kcy5lpaGKk40vT9Trk=; b=pYBaWSXTO+Wz8eDa1FUSKeX9XRTcRQiGR+tn0DaBZaj2pSQTCpNciw284AfXoUL43F9/pV ZOLFU7nwE/quHO0F/ujK2j9/zEHeD3HdpaL210Mc/1M7FdJZ3el8yttzJ7i5vac/ID3MFm wySJqyLXZNpqqqLQjb/IU/8eqp1/CndsZSgnYrYSbhZJ746MDVQ8yJRQpvfi1jPB/zpVOM YgnnRtaecElUEyVKkHOnWdGISCEUpK/RlIbSKRs79znEqHpzkOzefb9JTMgZ5b1AIwe0C7 6UOiqpAsvC0RbYOX2EZ7f/wtsT0JpFP5DGnM4zBa/Z9NqH2V2VUsw+l+0fMFBQ== DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=linutronix.de; s=2020e; t=1679658441; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version: content-transfer-encoding:content-transfer-encoding; bh=KDPHyC6kWyePMtKLTpdAD+GT0kcy5lpaGKk40vT9Trk=; b=p7MsW3zN+G0mjBxUNC5rQL58AdcZjYToNkx+sxTQB3HC9GmzxCrXtkkXG+pbPo6AYvg4le wr4fyU/kQ4RsauCw== To: Borislav Petkov Cc: linux-kernel@vger.kernel.org Subject: [PATCH] x86/microcode: move @microcode_mutex definition near usage Date: Fri, 24 Mar 2023 11:47:20 +0000 Message-Id: <20230324114720.1756466-1-john.ogness@linutronix.de> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Spam-Status: No, score=-2.5 required=5.0 tests=DKIM_SIGNED,DKIM_VALID, DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_MED,SPF_HELO_NONE,SPF_PASS 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 If CONFIG_MICROCODE_LATE_LOADING is not enabled, the compiler warns: 'microcode_mutex' defined but not used Since reload_store() is the only function using this mutex, move the mutex definititon there. Then it is also within the #ifdef block for CONFIG_MICROCODE_LATE_LOADING. Signed-off-by: John Ogness --- arch/x86/kernel/cpu/microcode/core.c | 28 ++++++++++++++-------------- 1 file changed, 14 insertions(+), 14 deletions(-) diff --git a/arch/x86/kernel/cpu/microcode/core.c b/arch/x86/kernel/cpu/microcode/core.c index 7a329e561354..e7b8f7ad105d 100644 --- a/arch/x86/kernel/cpu/microcode/core.c +++ b/arch/x86/kernel/cpu/microcode/core.c @@ -49,20 +49,6 @@ bool initrd_gone; LIST_HEAD(microcode_cache); -/* - * Synchronization. - * - * All non cpu-hotplug-callback call sites use: - * - * - microcode_mutex to synchronize with each other; - * - cpus_read_lock/unlock() to synchronize with - * the cpu-hotplug-callback call sites. - * - * We guarantee that only a single cpu is being - * updated at any particular moment of time. - */ -static DEFINE_MUTEX(microcode_mutex); - struct ucode_cpu_info ucode_cpu_info[NR_CPUS]; struct cpu_info_ctx { @@ -465,6 +451,20 @@ static int microcode_reload_late(void) return ret; } +/* + * Synchronization. + * + * All non cpu-hotplug-callback call sites use: + * + * - microcode_mutex to synchronize with each other; + * - cpus_read_lock/unlock() to synchronize with + * the cpu-hotplug-callback call sites. + * + * We guarantee that only a single cpu is being + * updated at any particular moment of time. + */ +static DEFINE_MUTEX(microcode_mutex); + static ssize_t reload_store(struct device *dev, struct device_attribute *attr, const char *buf, size_t size) base-commit: 1e760fa3596e8c7f08412712c168288b79670d78 -- 2.30.2