Received: by 2002:a05:7412:e794:b0:fa:551:50a7 with SMTP id o20csp1044435rdd; Wed, 10 Jan 2024 07:08:24 -0800 (PST) X-Google-Smtp-Source: AGHT+IEsBrO7HgxnboIgDRJpHzXIAIddaUT+R+6OQUqSuZ7QDTp9Q3ghnUQu07g8Kg54GcpBstUh X-Received: by 2002:a19:2d0e:0:b0:50e:3270:2bc0 with SMTP id k14-20020a192d0e000000b0050e32702bc0mr492253lfj.123.1704899304532; Wed, 10 Jan 2024 07:08:24 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1704899304; cv=none; d=google.com; s=arc-20160816; b=d7EZAQ9vzpACX3Fg9q7K9WSCG/lL+6DCLaQxQCcbFCObukvyb8pvHbSpxXXCNbesn5 AVPUna/QUPJT7DA/nbp5tYx3iJMITAgpMslqlihFWwxlgxtV2+qsrXtDNDRUmBbLObB6 5auaaBqw0ybmt3vqrQ6ZylVve7nm+h6rfpitbjR/MEmU2Ghemv9FhiJ8Qct4N2MVs3sK qZ145etzghNjeWTp3qSoqNIfpNbzT2Mh4PPiz5sLPad4Eo8dMzcyDfMUOgksTzEmzaq5 u/Xbe+ZSkP5pkbfGmpeia3PC31KUcN1d9o3WLRbEAKeuQxAARTIgZBuX3sz0f53t98ru MJ1Q== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=content-transfer-encoding:mime-version:list-unsubscribe :list-subscribe:list-id:precedence:message-id:date:subject:cc:to :from:dkim-signature; bh=DOwKQHMBULrU7xwun5pw8IsNhO9Q+ezf9iCAhEPbTMA=; fh=+6KIiIQx7RlBEpiJo3aozMdAMX7u/fPcgwx32k1QFuY=; b=pxtNx2dvR8vInZ73b4yZpBPJ6PJ7kCCvcyEqspCLERZKlKLwFFRMOaHew2EUPXWfTy ColyukSdU5TjDfwgHy+PyQEXSTLW6JilflzoJ3gWFMnhzWegvkcZXf5sa5WTS6yaB9YT HFjma2S9rNlQQ+P7q03Zq3LURUTXQtO2cM66qjtwBDWyA/kRIHqHKs/0Un73r3RzEwbS cloHyCwKejnnFixqLrML2OKpMUkVmqleIejVaTvgOAdoHPwIFhMFhilK1qhvLFsdaxxX cTU2/b0OFhbH7yqnS6q/mRBTFYwoHD4Yx8s+aUyMU9Dy3ze1KJ68cRQn/ut7ibfG2SPg Fn5g== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@intel.com header.s=Intel header.b="Hk/G1Yyg"; spf=pass (google.com: domain of linux-kernel+bounces-22395-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.80.249 as permitted sender) smtp.mailfrom="linux-kernel+bounces-22395-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=intel.com Return-Path: Received: from am.mirrors.kernel.org (am.mirrors.kernel.org. [147.75.80.249]) by mx.google.com with ESMTPS id h1-20020a170906718100b00a2a6fc65de6si1794986ejk.60.2024.01.10.07.08.24 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 10 Jan 2024 07:08:24 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel+bounces-22395-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.80.249 as permitted sender) client-ip=147.75.80.249; Authentication-Results: mx.google.com; dkim=pass header.i=@intel.com header.s=Intel header.b="Hk/G1Yyg"; spf=pass (google.com: domain of linux-kernel+bounces-22395-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.80.249 as permitted sender) smtp.mailfrom="linux-kernel+bounces-22395-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=intel.com Received: from smtp.subspace.kernel.org (wormhole.subspace.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by am.mirrors.kernel.org (Postfix) with ESMTPS id 46ADB1F22B06 for ; Wed, 10 Jan 2024 15:08:24 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 414B74BA9D; Wed, 10 Jan 2024 15:08:18 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=intel.com header.i=@intel.com header.b="Hk/G1Yyg" Received: from mgamail.intel.com (mgamail.intel.com [198.175.65.12]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 348A94BA85 for ; Wed, 10 Jan 2024 15:08:16 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linux.intel.com Authentication-Results: smtp.subspace.kernel.org; spf=none smtp.mailfrom=linux.intel.com DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1704899296; x=1736435296; h=from:to:cc:subject:date:message-id:mime-version: content-transfer-encoding; bh=sHwp7FLzZIlG5HFYdgHfqqle8SLGS8mrA0XxzJMtOUU=; b=Hk/G1YygGc3Lw1kYm84PJIaJNGJ2OJUSjaHeF/FP6Ba2r0B/8P2dU3WW NeJouDLUU52C2wYM9qxX01hWnvSnfoEB9Nt67K4JJpRuygLyw4OSWw2eR B7eHFQQzP4CAveEgLcyAmdPJXdYn39pWXUyDGUdlZXGeqj++2DMwUvgaM LdKqoApcXK6KU25v/VgGxj9XS0U+F2XvEPWwfYF9CFlV0+rgvgEIB+hTj AEKElmaN5Gv5HGntuL96JMrsv2p49WpKF6JyEi8LX4jb54vQ9z9hOL9/Z /+XBSNBBqPIXcbF2n01R+NpRoYMp8z6GaPzOV/7cxGfUHOTMWq+/ohE1h g==; X-IronPort-AV: E=McAfee;i="6600,9927,10948"; a="5904720" X-IronPort-AV: E=Sophos;i="6.04,184,1695711600"; d="scan'208";a="5904720" Received: from fmsmga003.fm.intel.com ([10.253.24.29]) by orvoesa104.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 10 Jan 2024 07:08:16 -0800 X-ExtLoop1: 1 X-IronPort-AV: E=McAfee;i="6600,9927,10948"; a="872673036" X-IronPort-AV: E=Sophos;i="6.04,184,1695711600"; d="scan'208";a="872673036" Received: from tassilo.jf.intel.com ([10.54.38.190]) by fmsmga003-auth.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 10 Jan 2024 07:08:14 -0800 From: Andi Kleen To: x86@kernel.org Cc: linux-kernel@vger.kernel.org, Andi Kleen Subject: [PATCH v2] x86/mtrr: Check if fixed MTRRs exist before saving them Date: Wed, 10 Jan 2024 07:08:06 -0800 Message-ID: <20240110150806.22531-1-ak@linux.intel.com> X-Mailer: git-send-email 2.43.0 Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: 8bit This one place forgot to check the fixed capability. Otherwise there will a harmless but ugly WARN_ON for the failed WRMSR when the MSR doesn't exist. Noticed when testing X86S support. Fixes: 2b1f6278d77c ("[PATCH] x86: Save the MTRRs of the BSP before") Signed-off-by: Andi Kleen --- v2: Add Fixes tag and expand description. --- arch/x86/kernel/cpu/mtrr/mtrr.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/arch/x86/kernel/cpu/mtrr/mtrr.c b/arch/x86/kernel/cpu/mtrr/mtrr.c index 767bf1c71aad..2a2fc14955cd 100644 --- a/arch/x86/kernel/cpu/mtrr/mtrr.c +++ b/arch/x86/kernel/cpu/mtrr/mtrr.c @@ -609,7 +609,7 @@ void mtrr_save_state(void) { int first_cpu; - if (!mtrr_enabled()) + if (!mtrr_enabled() || !mtrr_state.have_fixed) return; first_cpu = cpumask_first(cpu_online_mask); -- 2.43.0