From patchwork Thu Aug 3 08:32:53 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Sebastian Andrzej Siewior X-Patchwork-Id: 130481 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a59:9f41:0:b0:3e4:2afc:c1 with SMTP id v1csp1069765vqx; Thu, 3 Aug 2023 04:11:57 -0700 (PDT) X-Google-Smtp-Source: APBJJlEjWIRXdkiycN0bxcWQO0IhjAc3GsQ/yXzjuq6otms9ezAsHB4Mpsw95mxyePjgkKJiIwr8 X-Received: by 2002:a05:6402:55a:b0:522:946b:4e46 with SMTP id i26-20020a056402055a00b00522946b4e46mr7588223edx.24.1691061117379; Thu, 03 Aug 2023 04:11:57 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1691061117; cv=none; d=google.com; s=arc-20160816; b=d9B4V1WF8av2Zj+r1OSlZ2+52kSAY3fucFrdJtAQ5/2gWGu+0g73SkaXSjE2i+OzN/ g7PpMCD7UB1l3SQ0A7+553sPCXPoaKrydvkgJnPKORoxuu16k4E/w2yS/xDM2o6c5kf5 BzWCFs6MJcZ9PKeftsVGPcNmoyA3ej/Wv7cHo8ByqlimzhVWGFcgDXGm2Q9u/8EjvRVw dDw3Sv4xOe32wycjnym3w3ObvPk3Lvv9J3PJmqB2orUOj6PeyT7FWhpi7vzyxSWk4Apm 9xwaQtAM4R+E18s0QptqC6KKAbd/8ogCj6wYJtI3IszqnxAlBCIqK9I5+hmw5EhpSzAZ NqHA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-disposition:mime-version:message-id :subject:cc:to:from:dkim-signature:dkim-signature:date; bh=Rt7SzZxNCz3Ob9bL0UZFPQ8dPBEEt0ivUNFN0hErH2U=; fh=Fe3jhXr7J2Buw1D5YSqkn86S5vRZGatqkx1WsyiAPgc=; b=bW5uKovZrJWHKGUX17SUVb7YL2POP2ZncK0Krx2fComygf7rn4Iy0BSrRGsLfte+eG xyr2k/TAgH8z1eG6FX/DT4qdlsCmeCrRIJZrCtQCylIdEor/8lC3W1dKiz/NoYM9zQQ7 +nNWVpcCOt2c6jXfxBbkMkAgejfsLP22+iKHpWnpN8jqOpqLU/8PLhwBRMNqgd3jjhDb pZDiDetmVmFBSZDYc4e5PKmJm9CxUF8YDFVWdT0XnuICSh+xnkLfT7FX9DjoBrjBHhiP Pa73SRcv4b5445BsLGyuDH5DlQHXEgQKo5w4Sm6zlOlbhhVKi69lRsjpTSjxROtY7Kl6 W6eA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linutronix.de header.s=2020 header.b=0Hof1zx5; dkim=neutral (no key) header.i=@linutronix.de; 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: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id e18-20020a50fb92000000b00522307bf422si11765837edq.467.2023.08.03.04.11.33; Thu, 03 Aug 2023 04:11:57 -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=0Hof1zx5; dkim=neutral (no key) header.i=@linutronix.de; 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 S234690AbjHCIf5 (ORCPT + 99 others); Thu, 3 Aug 2023 04:35:57 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:55664 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S233889AbjHCIfj (ORCPT ); Thu, 3 Aug 2023 04:35:39 -0400 Received: from galois.linutronix.de (Galois.linutronix.de [193.142.43.55]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 1202F3ABB for ; Thu, 3 Aug 2023 01:33:00 -0700 (PDT) Date: Thu, 3 Aug 2023 10:32:53 +0200 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linutronix.de; s=2020; t=1691051577; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type; bh=Rt7SzZxNCz3Ob9bL0UZFPQ8dPBEEt0ivUNFN0hErH2U=; b=0Hof1zx5qRd+CcepuRrhbnfQPVWLdfWDm6Viy4K1w9ixH5mwC2763wkgKaMQq25QAnTBmo jCPXdiPNWnY9XIsGpZKtklz1EmkTVWzUdl9pH4MdtmehZeUs+/dlK6rWQD+OWtTUU4O0JD l3BITNrVi1CnM9gNTVqOobrHZv8k7I8jiMwN8a0SGJvNF8djJmv2JIR2eJLaUrSk7o+JZ+ 7ZVbv1nI41JNSwmXfiTooVt7cxRI2TAbSXrCqO7aI1lVH3UycitjuTwIy5RZnRJ3m2OfAH nl2kJCYBhDnvMVAuBb/Ubb5ahnddDi4LV5C4E9J9f+aqvanJS7m56tWJtg0zyw== DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=linutronix.de; s=2020e; t=1691051577; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type; bh=Rt7SzZxNCz3Ob9bL0UZFPQ8dPBEEt0ivUNFN0hErH2U=; b=VGrGhDE0UAHthR77cd66fLdNo0FHfwVdLFinZv8cLZl0KQZY/gnoGKQvmWYEe6aP8fc+8h I4clV73bHTDp+dBg== From: Sebastian Andrzej Siewior To: linux-kernel@vger.kernel.org, x86@kernel.org Cc: "H. Peter Anvin" , Borislav Petkov , Dave Hansen , Ingo Molnar , Thomas Gleixner Subject: [PATCH] x86/microcode: Remove microcode_mutex. Message-ID: <20230803083253.VGMnC9Gd@linutronix.de> MIME-Version: 1.0 Content-Disposition: inline X-Spam-Status: No, score=-2.1 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_BLOCKED, 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 X-getmail-retrieved-from-mailbox: INBOX X-GMAIL-THRID: 1773206101934393149 X-GMAIL-MSGID: 1773206101934393149 microcode_mutex is only used by reload_store(). It has a comment saying "to synchronize with each other". This probably means the sysfs interface vs the legacy interface which was removed in commit 181b6f40e9ea8 ("x86/microcode: Rip out the OLD_INTERFACE"). The sysfs interface does not need additional synchronisation vs itself because it is provided as kernfs_ops::mutex which is acquired in kernfs_fop_write_iter(). Remove superfluous microcode_mutex. Signed-off-by: Sebastian Andrzej Siewior --- This poped up as "defined but not used" on RT builds without CONFIG_MICROCODE_LATE_LOADING enabled. arch/x86/kernel/cpu/microcode/core.c | 6 ------ 1 file changed, 6 deletions(-) diff --git a/arch/x86/kernel/cpu/microcode/core.c b/arch/x86/kernel/cpu/microcode/core.c index 3afcf3de0dd49..2f9d35744bc41 100644 --- a/arch/x86/kernel/cpu/microcode/core.c +++ b/arch/x86/kernel/cpu/microcode/core.c @@ -54,15 +54,12 @@ LIST_HEAD(microcode_cache); * * 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 { @@ -488,10 +485,7 @@ static ssize_t reload_store(struct device *dev, if (tmp_ret != UCODE_NEW) goto put; - mutex_lock(µcode_mutex); ret = microcode_reload_late(); - mutex_unlock(µcode_mutex); - put: cpus_read_unlock();