Received: by 2002:a05:6a10:16a7:0:0:0:0 with SMTP id gp39csp3726302pxb; Tue, 17 Nov 2020 01:41:34 -0800 (PST) X-Google-Smtp-Source: ABdhPJyRWaup3mdArM7c8yMMTS7z8Iph1F5dLD/Rr6xudf2U08ry+hW+HWWPiywioT7WTLDoen9U X-Received: by 2002:a17:906:a047:: with SMTP id bg7mr2670538ejb.30.1605606093896; Tue, 17 Nov 2020 01:41:33 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1605606093; cv=none; d=google.com; s=arc-20160816; b=Yz2Wp/wNpe2BvbjUURGvNJlzdm2XTJYV+pW3JkUPnzWVuJ92BcrQdJ4pA76EemytLb mOAeHi+Za9xUv4kK4iOcD8ctGtZZmvc+xXP4VcgP8y5xD2TDrEBmS3/wbP+m97+PwlGq MaV0M5lDd2pketeHJm0Mk0NQeBiRG1jkLwrP3Q+U9BGamSFW9MOZtZL5TFxuStdWZmRN SpaaiNlrXGWW/3NPHcvax16im4eHeq0L5m4BSLYUJ1DQzjp7rOgUd0FubV8PcvSNmazY kgUbkg5GNKonW2SNjALBfbeCLUwIySchytc+VIb3G7SaHuLc/nBhbWRDb24VtLUmEr7J 5X3w== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:user-agent:in-reply-to:content-disposition :mime-version:references:message-id:subject:cc:to:from:date :ironport-sdr:ironport-sdr; bh=C+mPGh/iYh1wEvJ89gu+8TyPgpWvr+Gl2CxH9l8N9oM=; b=fAfaIyeI+9RtAC3wjIMxpJtMuFDE2vleVh1Ty6iFqvAYnsIQN6WbSWa6GkgBZNjXgU ajFzHevOHGTx8jtUyG8GJYSQFpZWMChntSBHNqwPbugixDyEnFBsy7f4ePEnQDsvbbOJ gFYe73tfjeRsn39/sGytW5z5TTkO9atH1EuJWyPDZ07rfBP6bIWL/lYiBng3asiPXjPB UDTj+ueArRL3yPqjIRsqD5Yl145L3nIYqyDiE5Je6YrgAz6PX4A6CzYddZDchORz/8yz Kd1m2nlUPWYrxb4HEEoTgGDFc4duEgR3qWFVo0mVch7rshC959dKCo+ym3faHLwkNTjM jX+w== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=intel.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id dc3si13207565edb.330.2020.11.17.01.41.11; Tue, 17 Nov 2020 01:41:33 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=intel.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726925AbgKQJiD (ORCPT + 99 others); Tue, 17 Nov 2020 04:38:03 -0500 Received: from mga01.intel.com ([192.55.52.88]:57794 "EHLO mga01.intel.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1725747AbgKQJiC (ORCPT ); Tue, 17 Nov 2020 04:38:02 -0500 IronPort-SDR: CmVeAxJX6sCmDwgOnJxM5l3LbrlcKeRBBq+zfAyojWZwSqbL7ttjGDkD5RZ/a/s7yL2PQqqF+D he6xXVuHyYlg== X-IronPort-AV: E=McAfee;i="6000,8403,9807"; a="188948140" X-IronPort-AV: E=Sophos;i="5.77,485,1596524400"; d="scan'208";a="188948140" X-Amp-Result: SKIPPED(no attachment in message) X-Amp-File-Uploaded: False Received: from orsmga005.jf.intel.com ([10.7.209.41]) by fmsmga101.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 17 Nov 2020 01:38:02 -0800 IronPort-SDR: 9Wb/Cym2213UyVcj5mi74cfc0lLAdtzPdRhFanxLYRQnQZ3Z18AHfBKRaupYDmSYGKSFT1Y8Uu J8rzXAJQztXw== X-IronPort-AV: E=Sophos;i="5.77,485,1596524400"; d="scan'208";a="543972342" Received: from chenyu-office.sh.intel.com ([10.239.158.173]) by orsmga005-auth.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 17 Nov 2020 01:37:59 -0800 Date: Tue, 17 Nov 2020 17:40:38 +0800 From: Chen Yu To: Borislav Petkov Cc: Andy Lutomirski , Ashok Raj , "Hansen, Dave" , Len Brown , "Rafael J. Wysocki" , Tony Luck , x86@kernel.org, linux-kernel@vger.kernel.org Subject: Re: [PATCH][v2] x86/microcode/intel: check cpu stepping and processor flag before saving microcode Message-ID: <20201117094038.GA22602@chenyu-office.sh.intel.com> References: <20201113015923.13960-1-yu.c.chen@intel.com> <20201116122735.GA1131@zn.tnic> <20201117022518.GA17555@chenyu-office.sh.intel.com> <20201117091837.GA5719@zn.tnic> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20201117091837.GA5719@zn.tnic> User-Agent: Mutt/1.9.4 (2018-02-28) Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Tue, Nov 17, 2020 at 10:18:37AM +0100, Borislav Petkov wrote: > On Tue, Nov 17, 2020 at 10:25:18AM +0800, Chen Yu wrote: > > If I understand correctly, the only place that invokes > > save_mc_for_early() is in generic_load_microcode(). While in > > generic_load_microcode() only microcode has a newer version will be > > saved by checking has_newer_microcode(), and this function leverages > > find_matching_signature() to check if the candidate is of the same > > signature. So when it comes to save_microcode_patch(), the signature > > already matches. In case save_mc_for_early() will be invoked by other > > function in the future, it is okay to add this check too. > > The important aspect is that you need to save in intel_ucode_patch > the *exact* patch for the CPU you're running on. The code above that > in save_microcode_patch() adds patches of the same family/model but > *not* same stepping to the microcode cache in case we want to support > mixed-stepping revisions. And those you don't need to check for exact > match. > > What I'd like, however, is to get rid of that mixed-stepping support - > which is total nonsense anyway, if you ask me - and that would simplify > the code a *lot* more. > Ok, got it, thanks. Best, Chenyu