Received: by 10.223.185.116 with SMTP id b49csp1045340wrg; Fri, 16 Feb 2018 11:24:01 -0800 (PST) X-Google-Smtp-Source: AH8x225DgBqFRIX6XKOvEyRiJr+ScCecMNls5mn/yUDk+IAiGHZqgluC5+gifRx57N+X0oQ2ZYqZ X-Received: by 2002:a17:902:718e:: with SMTP id b14-v6mr6933722pll.38.1518809041272; Fri, 16 Feb 2018 11:24:01 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1518809041; cv=none; d=google.com; s=arc-20160816; b=VqKjDDo+/OTCiLDvxIQx+yZTiXouC9R9cyx6F5XURNE1MqB8g0UArih1kBz+p4dAf0 Q8ftoze7Knjft3WPM7Fioc0g+ul2LCUG9n07on8jWK8wK9prWCvAFJ5yrt9St6txW8I2 IwJngHgjxaFqEh7zmwewPPTIfPI1wXWB2Ik6swJCyMIQU/zFs81cWq+4gX7QLGA57m9p uDN7fki2yTN6B+wK7cxcAvMU1Vz2Ec3KsWucIWUUEefn594vk3ZwAgJnko71boevGpRF ay2CzJ48X2FKb/RwPgHI9wC1SD9Su67jASrAAYx+mmgtmZwI6XbNguXYHiAPtw4TUT+D WEOg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:message-id:date:subject:cc:to:from :arc-authentication-results; bh=Y6WOYxLj/3MxzEv/h00faobBW7O+KJGGCffP8hFCF/w=; b=gppVpi0kNGOvE8ZvFFeiqXyMtvSMYHUHDZPOqkA8RZtb1qfEVbtRSiEdcMX6SbMy7O 97e0TcBd/GdLwEeh4FvWlJPML5Uv9ttPi6VALgUXJ83pSuxUirT22+nD+deLeJg+wF7v O4pL51YNt1In+V+AApLxT28R+If/8jdrn+J7+EXYs+Q/TsZbnbSp3fNuo0fWUYllPJHT OGGtaIuHEtiYlRN9R6E3It6PhM/zkp0w1GIYWunIOMusu3d39kUHjWUSGaGDwYS9S437 w+etZ/hkZb4j6Ma+yt96yEbyLXaRAOgQ06oCqLpGkA0WLmIfYOdAB5JRRxUrjKWXrGCu n0NQ== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id f12si1620416pgn.455.2018.02.16.11.23.46; Fri, 16 Feb 2018 11:24:01 -0800 (PST) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751370AbeBPSrD (ORCPT + 99 others); Fri, 16 Feb 2018 13:47:03 -0500 Received: from mga05.intel.com ([192.55.52.43]:42870 "EHLO mga05.intel.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1750913AbeBPSrB (ORCPT ); Fri, 16 Feb 2018 13:47:01 -0500 X-Amp-Result: SKIPPED(no attachment in message) X-Amp-File-Uploaded: False Received: from fmsmga005.fm.intel.com ([10.253.24.32]) by fmsmga105.fm.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384; 16 Feb 2018 10:47:00 -0800 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.46,520,1511856000"; d="scan'208";a="204831562" Received: from otc-nc-03.jf.intel.com ([10.54.39.38]) by fmsmga005.fm.intel.com with ESMTP; 16 Feb 2018 10:47:00 -0800 From: Ashok Raj To: bp@suse.de Cc: ashok.raj@intel.com, X86 ML , LKML Subject: [PATCH] x86/microcode: Check microcode revision before updating sibling threads Date: Fri, 16 Feb 2018 10:46:48 -0800 Message-Id: <1518806808-4074-1-git-send-email-ashok.raj@intel.com> X-Mailer: git-send-email 2.7.4 Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org After updating microcode on one of the threads in the core, the thread sibling automatically gets the update since the microcode resources are shared. Check the ucode revision on the cpu before performing a ucode update. Signed-off-by: Ashok Raj Cc: X86 ML Cc: LKML --- arch/x86/kernel/cpu/microcode/intel.c | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/arch/x86/kernel/cpu/microcode/intel.c b/arch/x86/kernel/cpu/microcode/intel.c index 09b95a7..5802c2f 100644 --- a/arch/x86/kernel/cpu/microcode/intel.c +++ b/arch/x86/kernel/cpu/microcode/intel.c @@ -786,11 +786,21 @@ static enum ucode_state apply_microcode_intel(int cpu) uci = ucode_cpu_info + cpu; mc = uci->mc; + if (!mc) { /* Look for a newer patch in our cache: */ mc = find_patch(uci); if (!mc) return UCODE_NFOUND; + } else { + rev = intel_get_microcode_revision(); + /* + * Its possible the microcode got udpated + * because its sibling update was done earlier. + * Skip the udpate in that case. + */ + if (rev == mc->hdr.rev) + goto done; } /* write microcode via MSR 0x79 */ @@ -813,6 +823,7 @@ static enum ucode_state apply_microcode_intel(int cpu) prev_rev = rev; } +done: c = &cpu_data(cpu); uci->cpu_sig.rev = rev; -- 2.7.4